3 ms·
> With Go, there's duck typing to not have to declare obvious types Not a Go developer, but I think you mean type inference, not duck typing.
by joshuacc 11y ago
> With Go, there's duck typing to not have to declare obvious types
Not a Go developer, but I think you mean type inference, not duck typing.
- stonemetal 11y agoNot really, Go uses duck typing for interfaces. You declare an interface to require functions X, Y, and Z. Any type that has functions X, Y, and Z suddenly implements that interface whether you want it to or not.
- joshuacc 11y agoAs I understand it, the correct term for that is "structural typing." Duck typing is similar, but applies exclusively to dynamic languages. See: https://en.wikipedia.org/wiki/Duck_typing#Structural_type_systems https://en.wikipedia.org/wiki/Duck_typing#Structural_type_sy...