3 ms·
> Go type system is not a traditional type system How so, I don't see anything special about Go's type system in the linked article.
by legulere 5y ago
> Go type system is not a traditional type system
How so, I don't see anything special about Go's type system in the linked article.
- noah_buddy 5y agoI believe they're talking about the semi-duck typing used in go for interfaces but I'm not certain. Interfaces are implicitly implemented with a runtime check determining whether a type x assigned to interface y is valid.This is why you'll often see an empty declaration in packages for structs intended to implement an interface like so: var _ y = x{} // syntax might be slightly wrong After writing this, I found the linked article in the OP link to what the author meant. https://rakyll.org/typesystem/ https://rakyll.org/typesystem/ There's really a bunch of small things that are different about golang that individually you can find elsewhere but are on the whole unique.
- politician 5y agovar _ = ThingerInterface(&Struct{}) Creates a compile time error if Struct is not a ThingerInterface.