That might be one of the most thoughtful blog post replies I've ever seen! 👍 I really appreciate what you have to say. I think I mostly agree with what you're describing…the major caveat being that I have yet to see gradual typing promoted within an org's culture. 🧐 source
In his post When Static Types Mask Code Smells Jared White reflects on a discussion about TypeScript and makes the case that static typing isn’t a panacea. It does not fix all your code problems. Indeed, it does not!
Jared closes with this observation:
Every programmer and every project is different, with unique needs. We should celebrate a diversity of approaches and techniques—not expect the industry at large to fall in line with a single perspective.
This is where I want to nitpick his analysis a little bit.
It is not that every programmer or every project has unique needs. From one area to another in one codebase we find different needs.
The core of that calculation module that has been driving the whole business for years. Different needs then the experimental service being tested on pilot customers. Different needs then the new web app component. Different needs than the high-performance logging engine.
TypeScript’s superpower that it supports different needs within an application (even within one file or class!) with different levels of static typing - by allowing for Gradual Typing. And it is not just TypeScript. Ruby has it with RBS or Sorbet. Python has it with type hints. Folks are proposing it for Elixir, heck, even for Java.
Enjoy the benefits of static & dynamic typing in different parts of the same program
Apparently, the only problem with Gradual Typing (and I found this while looking for languages that support the concept) is…