I am new to both. I cannot say anything reasonable myself.
I think this is actually a reasonable question to ask since Elm is both a language and a framework, and the compiler output of Elm is in the same language Svelte uses.
There have already been two threads about this with lots of details:
I cannot speak specifically about Svelte, but in general, the tradeoff between elm and [insert JS based language/framework] is:
- Elm has a great dev experience: less choices, tools mostly work together, no footguns, no runtime exception, easy/fearless refactoring when you are bored or when your code has grown too much.
- Elm has limitations too: some things requiring mutations or side effects are not feasible or not worth spending the time finding the best work around (it’s rare, but for a newcomer, it can be a deal breaker)
- Elm is awesome to expand your way of thinking and solving problems: introduction to functional programming, brave new approaches (lamdera, elm-ui, tons of other innovating things)
- [JS framework] is much easier to introduce to your coworkers or to get you a job.
If we are talking personal project @D_K don’t hesitate one second, and give elm a try. You won’t regret having tried it, and you might stick to it.
If we are talking new at-work project, don’t, especially if you are new to Elm and trying to introduce it in a context where others also don’t know it.
I wrote a decent amount of Svelte at my previous employer and Elm at my current so my options here are based on comparing the 2 experiences.
Svelte likes to market itself as a framework, though in Rich Harris’ own words it’s a language. I think this is mostly easily shown with Svelte’s use of
$: in its scripts sections and its custom syntax in it’s view sections. Its essentially a superset of TypeScript & HTML & CSS all in one.
We used Svelte to build https://developer.squareup.com/reference/sdks/web/payments, and it was mostly easy to work with. The primary issues I ran into were poor TypeScript support (there was a lot of tweaking to get TS types working properly), poor state management (it was ok initially but as the app grew it became a little more challenging), and maintaining of dependencies was a drag (Svelte moves very fast and if you fall too far behind it becomes difficult to upgrade).
I currently work on an Elm app at vendr.com that’s about 15 times as large as that Svelte app. Our build times are faster, the compile time error messages are significantly better, and it’s all around easier to maintain. We also use a fair amount of web components, which I think is a great choice.
I do think Svelte is a great tool for tiny pieces of view code, similar to how you might use a web component, however I still typically use Elm 99% of the time and plain JS the other 1% because it’s so much easier for me to work with.
Sounds like vendr is becoming a hub. Are there new elm libraries in the works that haven’t been announced yet?
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.