3 ms·
If you operate on a value, you are assuming that the value supports that operation, which means you have some information on the interface that the value suppor
by RussianCow 9y ago
If you operate on a value, you are assuming that the value supports that operation, which means you have some information on the interface that the value supports (i.e. a type). If you had absolutely no information about the interface of a value, you could not possibly do anything with it.
There is actually an entire category of static type systems called "structural type systems"[0], which is basically duck typing checked at compile-time rather than runtime.
[0]: https://en.wikipedia.org/wiki/Structural_type_system https://en.wikipedia.org/wiki/Structural_type_system