News for hackers. Stuff that matters.
Re:Exploring Polymorphism in C: Lessons from Linux and FFmpe... by layer8 on Monday March 10, 2025 @12:31PM (#43322271)
The difference is that in Go, an interface is assumed to match if the method signatures match. In other words, the match is done on the type structure of the interface, hence the “structural” designation. Nominal typing, on the other hand, considers that interfaces tend to be associated with important semantic requirements in addition to the type signature, and that mere type-structure matching doesn’t at all guarantee a semantic match. For that reason, the semantics are implicitly bound to the declared name of the interface, and the way for an implementation to claim conformance to those semantics is to explicitly bind itself to that name.

There are no comments on this comment yet.