← Back to context

Comment by krapp

8 years ago

You don't need compile-to-js languages to have the benefits that those languages provide. You could validate javascript for correctness and safety directly, or import js libraries which implement "types" which javascript doesn't support (because such types have to be to javascript anyway.)

But I think the primary reason to use languages that compile to javascript, rather than tools that work on javascript, is to avoid writing javascript.

That's like saying you don't need static typing if you just write better code.

The primary reason to use other languages is not to avoid Javascript, but to use better tools. I use Elm because it has built-in immutability (JS doesn't), a statically-typed ecosystem (JS' is bolted on in a side channel), a single architecture pattern (vs JS' redux/flux/react/angular/etc).

By the time you get static typing, immutability, and an architecture set up in Javascript, you may have taken on a bunch of libraries / moving parts that are more complex that using a different language that comes with all of that out of the box.

Saying I'm just trying to avoid Javascript suggests misunderstanding.