Hacker News new | ask | show | jobs
by joshuacc 3932 days 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.

1 comments

Not 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.
As 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_sy...