4 ms·
TypeScript is another mainstream programming language that allows, or even encourages, static duck typing.
by crabmusket 4y ago
TypeScript 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...