3 ms·
I'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"
by crabmusket 4y ago
I'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...