3 ms·
"Duck typing" can be done statically through row polymorphism. For more info, read up on OCaml's object system.
by nv-vn 11y ago
"Duck typing" can be done statically through row polymorphism. For more info, read up on OCaml's object system.
- mascarenhas 11y agoYou only need row polymorphism if you want full type inference. You can get away with width subtyping with bounded parametric polymorphism if you are willing to give up on inferring all types. Examples: Go, TypeScript, Flow...