re: Are you really using JavaScript? VIEW POST


You can write all kinds of things instead of JavaScript:

Whether or not you should and when is a pretty complicated matter, but many of the above choices do introduce clear benefits like type safety and property-checking at the language level or powerful new paradigms like Clojure's transnational memory system or Idris's dependent types, even when what's executed at the end is plain old ES5 JavaScript. Not all projects fit this bill, but many do.

To me, using TypeScript/ESnext+ JS is a very similar thing to using a different programming language entirely - introducing a more helpful environment for the programmer without compromising on the interface with the platform.


Great list, there are some languages I didn’t know could compile to JS, I’ll have to try them out!

Have you used any of these in the past (sounds like you’ve used Clojure) and what were challenges involved with using another language instead of JS?


I've used Clojure, Elm, PureScript, and OCaml from this list, and have Smalltalk on my "to-try" list.

The issues with using each choice are largely unique to that choice, but what you sacrifice by leaving vanilla JS is the ecosystem and support. You severely limit the resources available for troubleshooting, and I often ended up needing to adapt a resource I found to solve a problem in a different language. If the time you spend doing that sort of work is greater than the time saved by using a superior tool, the whole thing isn't worth it anymore.

I'd say for side projects these make a lot of sense, but it'd be a hard sell for a CTO.

Great insight, looks like you’ve experimented a lot. The ecosystem is a big plus for JS right now.

I guess it always comes down to:

I'd say for side projects these make a lot of sense, but it'd be a hard sell for a CTO.

I actually forgot to mention one of the more robust solutions - I think Fable for F# as part of the SAFE stack may be a viable contender, along with ClojureScript, for an enterprise-grade solution. Those two stand out to me as the most generally useful options, here's hoping that maturity continues to increase.

I’ve played around with F# but I haven’t properly tried the SAFE stack. That might be a good weekend project to try.

I haven't spent a ton of time with it either, but the demo "dojo" project they have set up is really well done and shows you all the moving parts. I'm impressed with the polish of pretty much all the F# resources I've come across.

code of conduct - report abuse