Hacker News new | ask | show | jobs
by hongboz 3607 days ago
For people who want to do typed functional programming on JS platform, there is another candidate: BuckleScript for OCaml: https://bloomberg.github.io/bucklescript/js-demo/

The compiler is compiled into JS and native code.

It generates highly readable JS code and easier FFI.

It compiles super fast (generally 10~100 faster than Scala) and generates optimized code.

2 comments

And you can use it with React Native![1]

[1] http://www.navision-blog.de/blog/2016/08/06/fable-react-nati...

there's also elm and purescript, both of which are haskell likes
As well as GHC JS (not that I'd recommend it over Purescript)
The huge difference is that Scala.js is production-ready, the other ones mentioned aren't.
Purescript is pretty production ready. It's in use in production in a number of places.
I'm not sure if Scala.js is production ready, but both Purescript and Elm have been used in production for a few years.
By what measure is Scala.js more production ready than ghcjs?
I feel like you've not seriously used each of them. Ghcjs is very interesting, but also very, very early. The ecosystem is tiny, the compiler produces huge and slow builds, the interop is tricky, the semantics imperfect. It may be a very long time before any of those are resolved, too! Compiling a lazy language to Javascript is no simple trick. Luite deserves all the praise in the world for getting it this far... but there's just a long way to go.

So, in the terms of this article, Ghcjs might be around the same place Scala.js was 2 years ago. In the mean time, Scala.js has taken off in a lot of ways. It's yet to be seen what will happen with Ghcjs.

Your hunch is correct, I have not really used either, I'm just generally interested. From a distance, they both appeared to be ambitious and somewhat immature. I'm curious about your comment regarding tricky interop and "imperfect semantics" of ghcjs, could you elaborate? Certainly laziness does make FFI harder, but I wouldn't call that a problem with the semantics.
FWIW, this matches my understanding of the situation with Ghcjs, although there's substantial risk that my understanding is dated.