DEV Community

loading...

Discussion on: The Problem with Interfaces, and how Go Fixed it

Collapse
iglosiggio profile image
Ignacio Losiggio

I added these links on the twitter thread but i think that i would be useful to leave them here to!

The first comment is that the go interfaces remind me a lot on haskell's type classes which on quick search are compared a lot with classic interfaces

And upon reading on type classes i stumbled with a C++ proposed feature that the call concepts and that page gives a bit of insight into how's all this compiled statically.

Collapse
coreload profile image
📶

Haskell type classes are syntactical. There is no runtime dynamic dispatch. Go interfaces are structural types, their implementations are always inferred, and their purpose is solely for runtime dynamic dispatch.