Mark Lewis
Jan 19 · 2 min read

I’m one of those people who hates dynamically typed languages and what I dislike is related to when a lot of errors are detected, therefore, it is the dynamic aspect that I dislike. I am much more productive when most errors are caught in a compile phase. This enables things like an IDE that can underline most of my typos and tell me quickly that I screwed something up.

Consider I have an object called “bank” that has a member called “accounts”. Being human, every so often I will type “bank.account” or “bank.acounts”. In a dynamically typed language those typos will be discovered when that line of code is executed. In a statically typed language the same errors will be underscored in my IDE. I save lots of time by having those simple things pointed out sooner rather than later.

How much time is saved depends a lot on the nature of the language, the runtime error messages, and the exact type of the error. I find that JavaScript is especially horrible because it tends to suppress errors and just tries to keep going. Consider if my code was “foo(bank.account)” instead of “foo(bank.accounts)”. It doesn’t crash there where my typo was. Instead, it passes an undefined into foo and just keeps running. It won’t actually crash until I try to use that value at which point I’ll get the highly uninformative message about trying to do something with an undefined. Tracking back to where I actually messed up can take a lot of runs. That’s a huge waste of time and there is really no reason for it. This is why things like TypeScript are so popular. I personally prefer Scala and Scala.js, but anything to get out of the dynamic hell of JavaScript and get syntax errors instead of cryptic runtime errors is a huge benefit.

Mark Lewis

Written by

Computer Science Professor, Planetary Rings Simulator, Scala Zealot

Top on Medium

Ed Yong
Mar 25 · 22 min read

12.2K

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade