Skip to content

Comment on C# almost has implicit interfacesparent

Comments

What about methods that share a signature but have a different meaning?

The interface can have a comment documenting what it's supposed to do. Any class/function that explicitly implements said interface should adhere to that definition/meaning. Any function that implicitly implements it... who knows what was intended.

In theory, you have a point. However, in practice it doesn't matter. It is extremely unlikely that the code is written in a way where random, unknown implementations are being passed around and called.

But then, in practice, why is it a problem to be explicit?

It's not; never said as much.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.