3 ms·
"that it takes considerable time and effort to come up with the right set of types. " I've written once here before, this is one of the 'accidental advantages'
by sonnyblarney 7y ago
"that it takes considerable time and effort to come up with the right set of types. "
I've written once here before, this is one of the 'accidental advantages' of TypeScript: you set the compiler 'loose' when you're hacking away, writing quickly, and then 'make it more strict' as you start to consolidate your classes.
I almost don't bother to type something until I have to. Once I see it sitting there for a while, and I know it's not going to change much ... I make it a type.
It's an oddly liberating thing that I don't think was ever part of the objectives of the language, moreover, I can't think of any similar situation in other (at least mainstream) languages.
- oefrha 7y agoBut you can basically do the same thing in Python? Add type hints at any time, check types at any time. Type hints can also serve purely as hints to programmers and not checked at all.
- nybble41 7y agoYou can do that in Haskell also. Just turn on the -fdefer-type-errors GHC option and leave out most of the type signatures. Any expression with a type error will be reported when/if the expression is evaluated at runtime. You'll probably still need a few type hints, to avoid ambiguity, but otherwise it's not that different from programming in a dynamically-typed language.