le cahier de mes réflexions

The unbearable typelessness of dynamic languages

Bowler Hat

People adore the irresponsibility and the dark magic that arrives with languages like JavaScript, Python, Ruby, etc. to name a few. Assign a value to an identifier but forget its identity (aka type) and let the interpreter or perhaps compiler to figure on its own. This dynamism, hence the name “dynamic language”, gives you the freedom to perhaps suspend pensiveness beforehand on data types and instead focus eagerly and clearly on the problem in hand. But is it really worthwhile?

I love Python… maybe everyone these days. Universities are springing up courses in its name, folks from non-CS backgrounds (chucking… even CS ones too) pull this for fulfilling their whimsical creative juices, you see tremendous library support (same for JavaScript, I mean you can code desktop apps in it) and blah blah. The power of this and similar, yeah of the so called dynamic languages, is that a novice and not-so-trained in tech can enjoy it and deliver something usable. That’s their power… but, with great powers come great responsibilities.

Code something of a medium sized project in JavaScript or Python, we’ll take Python for brevity, and soon you will realise that you have plunged yourself in the hell of typeless, fluid or to say spooky identifiers. I don’t even want to call them variables (just my personal trauma). Vault from file to file trying to figure out from where the variable actually emerged and during the course of its life to what it became and what it actually is when you really commenced your prodigious vaulting search. If this isn’t hell then what it is? It is best defined, philosophically, as the manifestation of post-modernism in computer languages, don’t start judging me please, where identifiers got no inherent meaning. What a tragedy… but aren’t tragedies great? Ask Greeks please!

For small or research projects, these languages suffice. Even for scripting or not-so-complicated bearing, these are adorable and lovable. I have a confession: I love using them in coding interviews to get aced! and it really helps, please do it (being honest here… no sarcasm ever intended). However, something may chime in your lovely mind, what about the type annotations or non-standard libraries that provide this functionality, for JavaScript we have TypeScript (what a horrible stuff, when all others required a library, we spun a new language for JavaScript), for Python pydantic and typing, etc. But do these annotations really help? By help I mean are they optional? Optional in all cases or some specific cases? Does language enforce any type casting and/or deduction rules or what sort of? What about compiler optimisations? What about overall architecture and code readability? Code verification and analysis by human-eye?
Suppose we use these features then it is similar to using four wheels for a bike but, that doesn’t change the reality of the bike nor does it make it an alternative to a car. The raison d’ĂȘtre of these languages was for some domain with some specific choices and decisions. Good engineers use relevant tools for the job and not a single one for virtually everything.

Even if today’s linters and intelligent IDE’s help you, it doesn’t mean that issue is resolved. Just give yourself a taste of something appreciatively sizeable project and you will remember me (perhaps for no good reasons). When you code something sizeable, interesting new problems arise and if you still think that code correctness and data integrity (specially throughout the lifetime of program), readability, apprehended data comprehension and some other similarly lovely issues do not become part of the project then I must say you need to code something serious or have it critiqued (perhaps by me). Exceptions exist but they are exceptions for some reason. But, if you believe that TypeScript solves JavaScript issues? Meh! that’s ridiculous. I will pick this topic some other time and then you can hurl stones on me (again).

Nevertheless, it is stupid to engineer substantially large in dynamic languages and to witness the Dante’s Hell in your files. Abstain from it. Well, don’t take my precaution for small sized endeavours or efforts of similar nature neither do think that we cannot make something serious using these. There is stuff out there which is serious and appreciably reasonable too (which I adore as well).

Leave a Reply

Your email address will not be published. Required fields are marked *