3 ms·
You're getting downvoted because the most well known duck-typed languages, and probably where people first learned the term from, are all examples of very dynam
by kjeetgill 4y ago
You're getting downvoted because the most well known duck-typed languages, and probably where people first learned the term from, are all examples of very dynamic languages like python, ruby, and even js.
I'm sure there are others but the main language anyone knows static duck-typing for is go. In go at least, the interfaces get checked against implementations based what instances are bound to what interface variables or parameters at compile time.
- kevin_thibedeau 4y agoJust to add more detail. SQLite was designed for Tcl interop. Its typing model reflects that.
- crabmusket 4y agoTypeScript is another mainstream programming language that allows, or even encourages, static duck typing.
- throwaway932345 4y ago[dead]
- crabmusket 4y agoI'd say that structural typing is a type system feature/paradigm that enables you to use duck typing in a statically-verifiable way. Duck typing is a "pattern" which you can do in dynamic languages (because there's nobody checking), or in static structurally typed languages. I'm not sure why you'd call duck typing "dogma"? It's just a way of writing code. https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgCIFcEGtgGcAWyA3gFDLIDucANlgBQCUAXMgG4D2wAJmcgI7pE9Zm048AviRIJqcXLmQBBBGEHUM2Yryq1GxZAnYhc7ahAB01dgHM6Acipcu1UNbsNkk8gKF6iBoxMzSxt7H2wAQndPEklpWXlkAAVoExBUKAh5CC5FXA0sLXIdYX1DY1MLK1s7AAdMyBAuV2Qwdko4JzNor35BbD8AiuDq+2AAW1b2MBpqAE9kOGQuTEL8OHWe2KkYdBAVYCNkdFwIArouFgK8fA9Sci5zEsZeR-DhbZITs9W6EAgKEoVGpzgwGF9Tud-oCUlA0hksqdcvlfmCgA https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgA...
- throwaway932345 4y ago[dead]