3 ms·
> In reality, gradual typing ends up giving you the worst of both dynamic and static typing: you get the uncertainty and lack of safety (in dynamically typed co
by ashton314 3y ago
> In reality, gradual typing ends up giving you the worst of both dynamic and static typing: you get the uncertainty and lack of safety (in dynamically typed contexts) of dynamic typing, and the cost of trying to fit your ideas into a statically typed type system.
Depends on how you implement gradual typing. There's a spectrum [1] of gradual languages, and the differences between, say TypeScript and Reticulated Python matter a great deal.
It is true that you can have some serious performance hits on the migration from dynamically typed -> fully typed code; my advisor Ben Greenman is doing work examining that space of performance en route to fully-typed systems.
In practice, there are several gradually typed languages that give you very good performance when all the code is typed—i.e. you don't have to pay a cost just for having dynamic in your language. You might have to pay a cost when you use it, and the cost can vary dramatically.
Note that's just performance—sometimes performance matters less than being able to prototype something fast in a language, which is a feature I find valuable.
> In fact, the few places where dynamic typing was used in the standard library was due to the type system not being powerful enough to provide a better alternative.
Hey, that sounds like either a win for gradual typing, or a sign that your type system needs some serious work! ;-)
[1]: https://prl.khoury.northeastern.edu/blog/2018/10/06/a-spectrum-of-type-soundness-and-performance/ https://prl.khoury.northeastern.edu/blog/2018/10/06/a-spectr...