Things I Was Wrong About: Types
I see a lot of comments on HN the last few years that just assume the dynamic vs static debate was settled at some time. It never ended. Static typing merely became trendy because dynamic typing was the trend for many years (Ruby, PHP, Python, Perl, JavaScript). Like all fashion, things that are trendy will once again become untrendy, and the cycle repeats.<p>With that said, it&#x27;s important to note that type inference is not new. I was doing type inference with Scheme nearly 20 years ago. I believe the reason it never took off in a serious way is because it combines all the downsides of dynamic typing with the downsides of static typing. Types are meant to document code. Without the annotations, you can&#x27;t look at code and know what is going on. Which, ironically, is the complaint against dynamic typing. In addition to that, you get the pain in the ass of having the compiler always complaining. And because it&#x27;s inferring types, the error messages are towers of baffling nonsense. It&#x27;s the worse of both worlds.<p>One thing that never comes up in these discussions is the idea that creating <i>good</i> types is a skill itself. Much like naming variables, if you don&#x27;t design your types correctly, your entire code base suffers. It&#x27;s much easier in a dynamically typed code base to &quot;nudge&quot; the data in a certain direction than in a static type system where all types are locked down at initial design time. In addition, certain type systems are much harder to master than others. I&#x27;ve worked with dozens of TypeScript developers and not a single one really knew what they were doing. They were appeasing the compiler and little more than that. There are also plenty of footguns in TypeScript that even TypeScript experts continually forget. I could continue on the weakening of the value of TS (via &quot;any&quot; and &quot;ts-ignore&quot;, etc.) and how these completely muddy any sort of metrics one may have on deciding whether types are &quot;worth it&quot; or not (or the fact that such metrics do not, in fact, exist). But that&#x27;s enough ranting for one day.