Hum... Not really!
It's a common misunderstanding because in fact it can relate to the duck type mantra:
If it looks like a duck and quacks like a duck, it's a duck
We can achieve this effect this way
Ok but what is the difference?
Well, the duck typing is resolved in runtime (ruby, python) while in Go it occurs in compile time.
Because of that, in Go it is called structural typing
(sometimes you'll find it named as signature-based polymorphism).
Top comments (0)