DEV Community

Cover image for The Compile-To-JS Zoo

The Compile-To-JS Zoo

Ben Lovy on November 20, 2018

There are lots of tools that promise to let you write your client-side code without touching an ounce of JavaScript. Which ones does the Dev.to co...
Collapse
 
antonrich profile image
Anton

Highly recommend Elm (it has everything, its own package system as well, no runtime exception - and that is true and has been tested in production).

Collapse
 
vitalcog profile image
Chad Windham

+1 Elm!

While I actually don't favor anything over vanilla JS, if you absolutely want to compile to JS from something else, Elm seems to offer some cool stuff. I've dabbled with it and it is a lot of fun. Wish it were more popular.

Collapse
 
antonrich profile image
Anton

It is somewhat Haskell like, but doesn't have typeclasses.

Collapse
 
deciduously profile image
Ben Lovy

This is my trepidation - typeclasses are one of the things I love most about Haskell. Is it limiting to not have an analogous system?

Thread Thread
 
antonrich profile image
Anton • Edited

I hear both sides of the story. The general picture is:

  • people coming from JS are raving about Elm when they get it.
  • people coming from Haskell miss typeclasses a lot and are not fond of lack of typeclasses. I guess the only way to find out is try for yourself. It won't take a lot of time because you are familiar with Haskell.

I personally don't mind that at all. The language is very productive after all.

P.S. I was, maybe, a little bit misleading. It doesn't have typeclasses. But it has types and type inference as well. You can define your own types with custom types (previously known as union types).

Thread Thread
 
deciduously profile image
Ben Lovy

Fair enough! Thank you.

Collapse
 
kspeakman profile image
Kasey Speakman

Fable-Elmish. It’s basically MVU (hence “elmish”) in F#. Plus the ability to write your own effects in F# (and synchronous if you want). Also auto gen JSON parsers if you know the JSON structure up front. The F# code is translated to JS thru Babel (hence Fable). It uses React to render the UI.

I still hate front end build stuff. But these tools at least make the coding part of the UIs nice.

Collapse
 
deciduously profile image
Ben Lovy

Huh, this sounds really nice. I've never touched anything .NET, but if I did I always assumed F# would be my jumping off point. I'll have to look more into this, thank you!

Collapse
 
cjbrooks12 profile image
Casey Brooks

I'm starting to explore using Kotlin/JS. I'm really intrigued by the idea of being able use one language to create libraries shared by frontend web, Android, iOS, and the server, but haven't really done enough in it to know how well it actually works for frontend web dev.

Collapse
 
deciduously profile image
Ben Lovy

Awesome! In a similar vein, I've heard that people who try out ScalaJS never really want to use anything else.

Kotlin is seeming more and more like an excellent choice for my "new language of the year" in 2019.

Thanks for the recommendation!

Collapse
 
antonrich profile image
Anton • Edited

By the way, the JS itself compiles to JS(Babel).

Collapse
 
deciduously profile image
Ben Lovy

True enough! It's rare not to use some sort of compilation pipeline these days. Not to mention JITing engines in most major browsers

Collapse
 
vladyio profile image
Vlad Andreev

Take a look at Mint. It certainly has some potential.

Collapse
 
deciduously profile image
Ben Lovy

Interesting! Never heard of this, thank you