DEV Community

Discussion on: A tour of all Elm commands

Collapse
 
aminnairi profile image
Amin • Edited

Thanks for taking the time to write such an interesting comment (and a question I guess)!

Elm is based on the functional reactive programming style, which is a style of programming that is less known by beginners. As the major market share are distributed across frameworks built on imperative/object-oriented programming style, it means that using Elm is an added effort, other than the one made to learn a new framework (Elm is both a completely new language and a framework).

And in my opinion, people will want to have something easy, rather than something reliable. And I think that this is a shame because the effort made to shift from OOP to FP is really worth the effort, but there are not that many people advocating for that and this is also to me another reason for the unpopularity of Elm and others functional languages like Haskell.

And last, as you perfectly said, the ecosystem. But this is not true anymore because you can do things that you were used to do in others framework like using a router, modeling 3D programs using WebGL, having interactive applications communicating in real time etc...

I suggest, if you did not already, you watch this excelent talk from Richard Feldman about why functional programming isn't the norm today given all of the advantage linked to the functional programming.

Collapse
 
leob profile image
leob • Edited

Well actually I see it as an advantage that Elm is FP ... :-)

I've played a bit with Haskell in the past and while I found it pretty abstract and academic it intrigued me too. Then recently I started working with Rust, and it reminded me a lot of Haskell (even though Rust is not exclusively FP).

And even the Javascript world is gradually moving towards FP ... filter/map/reduce, React with pure functional components and Hooks, RxJs ... the move to FP is there.

Interestingly I recently came across a very interesting article (codeburst.io/faster-web-c6823830ce72) arguing that frameworks like React (and Vue, and so on) are slow (which I didn't realize because we're always being told that 'virtual DOM is fast'), and this article then went on to mention a technology called Imba (imba.io/).

I never heard of it before but right away it reminded me of Elm, and of Svelte. Both Imba and Svelte are compilers, which allows them to generate very fast and optimized code to manipulate the DOM. Now, Svelte is just Javascript but Imba uses its own language, which made me think of Elm :-)

So now I wonder, does the Elm compiler also manage to pull off generating crazy fast DOM manipulation code, like Svelte and Imba do (meaning, way faster than React or Vue) ?

Finally, have you ever heard of (or looked at) ReasonML ? reasonml.github.io

It's based on OCaml and made by the same group within Facebook who made React. Reminds me a lot of Elm in various ways: compiled, strong typing, FP, compiles to Javascript etcetera. I think it operates in the same space as Elm.

Thread Thread
 
aminnairi profile image
Amin

I'm not sure if Elm does what Svelte and Imba does on the optimization side for fast VirtualDOM rendering but I have read an article stating that the unoptimized (unkeyed) virtual DOM used in Elm is way faster than those used in React or Vue. Now this was a rather old article that was benchmarking using Elm 0.17 (we are now in Elm 0.19.1). So I don't know if this is still the case but I guess FP helps a lot in the optimization process.

I have been intrigued by ReasonML for a while. I love the project. I am not the best fan of the syntax but you can virtually do anything with the FFI capabilities of the language and with time (using Haskell & Elm) the syntax barrier begins to fade away.

The article you linked was very interesting! And I didn't know about Imba. I'll sure be playing with it. Looks promising too!

Thread Thread
 
leob profile image
leob • Edited

The interesting thing about the article for me was not so much Imba but the huge performance differences. Those differences do not just impact the end user of the app, but also the developer, because development becomes much more simple.

It's so fast that there's no more need for clever tricks or complicated techniques to optimize speed of your app - even if you just use plain and simple JS arrays and objects and mutate things willy-nilly it's still fast enough. That was really an eye opener for me.

What I notice about ReasonML though is that you aren't hearing a lot about it, it hasn't been able to break out of its tiny niche. It's not become mainstream, far from it.

The problem for all of these JS alternatives (Elm, Imba, ReasonML) is the small community and ecosystem compared to the established incumbent, Javascript.