5 ms·
All that instead of type classes eh?
by VirusNewbie 3y ago
All that instead of type classes eh?
- valenterry 3y agoIndeed. Pains me to see what they are doing while not learning from existing and well established language patterns. I understand that Go wants (or wanted) to stay "simple" but now it seems to become the worst of two worlds: it's neither simple anymore but also doesn't benefit from high level language features like typeclasses because it's too late to add them now.
- aatd86 3y agoIt's more similar to semantic subtyping as a set interpretation of some types. That avoids having different constructs for similar things. Personally I find this elegant.
- assbuttbuttass 3y agoGo has type classes, they're called interfaces
- VirusNewbie 3y agoNot the same, because with an interface, the methods defined for the struct must match the interface. With type classes you can bridge that gap because the implementation of the struct for a specific type class can be defined anywhere.