All those paradigms in JS
Epistemic status: random thoughts on one afternoon.
I’m preparing a presentation about borrowing from functional languages into JavaScript. In it I talk about pattern-matching, function composition, static types found. For some of them, like pipeline operator or pattern matching, there are proposals to add them to JavaScript.
At first it sounded like a great idea to me, because I do find those features useful and so I would like them to be present in the language that I use. However, at one point in the past I stumbled upon a person that wasn’t really happy about adding so much stuff into the language. I have dismissed that pretty quickly then, but now I find this a valid concern.
But isn’t JavaScript the only language we can write web front-ends in? Isn’t JavaScript a lingua franca of the web? Shouldn’t we put in as much nice things as we can so everyone gets what they like?
No. Yes. Probably?
There is a difference between writing a script that adds snow to your website and building a fully-fledged application. JavaScript is actually kinda cool at the former. When I compare it to something like Bash it’s actually a big improvement.
However, building something that doesn’t fail too often, that models some business process, that should respond to changing requirements is a very different beast. This is something I find JavaScript not that good for.
Fortunately, people are building upon it and making it a compilation target of some… nicer languages. Examples of such languages are Elm, Closure (ClojureScript), F# (Fable) and PureScript, to name a few I heard of. Oh, and TypeScript if you’re into that kind of thing.
Now, it actually makes sense. It would worrysome if we were locked into all the design decisions that were made 20 years ago, in very different circumstances. Languages are also pieces of software (sic!) which can be changed and which, crucially here, can be built upon. Much like it happened with assembly and C.
I am really glad that there are people Rich Hickey or Evan Czaplicki who rethink how we do things and actually do something about it. Something that all of us can benefit from.
So not only that, not only do we get nicer languages which build upon our knowledge about how to do programming well, there are also people who come up with things like WebAssembly, which kinda take care of the other, low-level end.
So, is JavaScript getting full of stuff? Yes it does. Should we add more? Well…
