To view parent comment, click here.
To read all comments associated with this story, please click here.
As I've said "up-teenth times" it is still crystal clear.
Your example makes sense in Go. The issue that you're missing is that the only time it matters if something does implement an interface is when you're using an interface as a parameter. In which case your example is more literally:
"Any valid object for this parameter must have the methods defined by this interface"
And again, if it doesn't the compiler will "kick your ass straight away".
In my opinion, you're focusing way too much on the definition of an object and no where near enough on actually using the object. So I'll repeat:
An object has methods defined with it, these methods are sufficient to tell you what the object can do. Interfaces are a separate concept designed to provide a contract for parameters. Thus mixing the interface with the object is redundant.
Go as a language tries to avoid redundancy. Maybe this hurts readability in your eyes, but in practice there's no difference and the "issue" you seem to have never comes up.
You keep on missing the point.
There is a keyword in Java that say
public MyClass implents IMyInterface.
That keyword is unambiguous. I can read the line and say to myself ... If MyClass does implement the interface correctly it won't compile.
It called readability and you keep on ignoring the fact that I keep on saying the say thing and you address it with some bullshit work around. Which I don't think is acceptable.





Member since:
2009-08-18
I explained it up-teenh times as my Grandfather would say.
It is about readability and I want to know before compile whether I am writing the code correctly ... just an odd habit I have.
I think unless the code is crytal clear on its intent then it is not correct.
I work with a lot of developers, some are my skillset, some are better.
Some have re-skilled via courses and we obviously have juniors.
It is easier to tell them with a language when this word is put in front of a variable that is changes the accessibility of that variable ... same with the interfaces.
For example.
I can tell them "If the interface has these methods defined then anything implementing them must implement them".
It is crystal clear, there is no implied. The compiler will kick your ass straight away even if the IDE of choice doesn't tell you before hand.
I believe you are simply missing the point on purpose at this point in the discussion.