3 ms·
From your second link: https://en.wikipedia.org/wiki/Duck_typing#Structural_type_systems https://en.wikipedia.org/wiki/Duck_typing#Structural_type_sy... > Duc
by redmorphium 7y ago
From your second link:
https://en.wikipedia.org/wiki/Duck_typing#Structural_type_systems https://en.wikipedia.org/wiki/Duck_typing#Structural_type_sy...
> Duck typing is similar to, but distinct from structural typing. Structural typing is a static typing system that determines type compatibility and equivalence by a type's structure, whereas duck typing is dynamic and determines type compatibility by only that part of a type's structure that is accessed during run time.
- kazinator 7y agoThat looks like ooks like "original research". It's obvious that what is described as dynamic-only duck typing could be statically checked. So that is to say, a given expression foo.bar in the program could be statically checked to make sure that all possible values that foo takes on have property bar. If three classes A, B, C in the program have property foo, then this means verifying that foo is A | B | C. Thus, "static duck typing".