Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Just because the method complies to the interface does not mean it does what you would expect from it.

static fulfilment != semantic fulfilment.



You could equally say that just because a class declares that it "implements" an interface, it doesn't mean it does what you would expect from it.

In practice, there is no language that can save you from people with malicious intent to confuse you.

In practice, this is rarely an issue.


There is a big difference.

When a developer makes a class implement an interface s/he signing a contract thus validating assumptions.

When a type in Go matches an interface, it happens by chance.


Utter nonsense. Either a function/method is semantically compatible with the expectations of its caller, or it is not.

Whether or not the function/method's author typed the words "implements Foo" has absolutely no impact on this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: