Skip to content

Comment on C# almost has implicit interfacesparent

Comments

I agree with you, but I can think of one counter example from Go. “crypto/rand.Rand” and “math/rand.Rand” both satisfy “io.Reader” which has lead to people inadvertently using the less secure choice.

That said, I think it is less about implicit interfaces and more about confusion between similar namespaces. After all “bytes.Buffer” also satisfies “io.Reader”, and I don’t see people confusing it with “crypto/rand.Rand”.

AboutSource Built by g1lg1l

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