9 ms·
I moved from React/Redux/Typescript to Elm a few months ago, and I'm now on my second serious project with it, making mobile application with Cordova. I've fou
by ccapndave 10y ago
I moved from React/Redux/Typescript to Elm a few months ago, and I'm now on my second serious project with it, making mobile application with Cordova. I've found it an absolute pleasure to use, and I especially like that you can be pragmatic about it; if there is something that is annoying to do in Elm then you can simply drop into Javascript/Typescript using ports.
Coming from languages like Actionscript/Javascript/Typescript/PHP I have found the whole Elm experience quite mindblowing; if it compiles, then it just seems to work. I hardly ever find myself poring over bits of code trying to debug a subtle error, and if I do the problem is going to be in the Javascript/Typescript bit.
Basically, I'm sold :)
- timroy 10y ago"if it compiles, then it just seems to work" Man, now that is tempting. Also, how easy are the ports? In ClojureScript you can use JavaScript pretty directly, but I often got a bit hung up translating the syntax (it's not that hard, it was just me).
- ccapndave 10y agoI've never used ClojureScript so I can't speak for that, but the ports are now a lot easier in 0.17 as an outgoing port is simply a function that you can call, instead of messing about with Signals. Effectively, you send stuff to Javascript by calling the port function with a Javascript compatible value, and then you subscribe to messages on the way back in, which end up triggering a message on the update function of whatever component sent it out in the first place. TL;DR its pretty easy once you've done it a few times
- Skinney 10y agoPorts are essentially event emitters. You can expose them from elm, and in your JS code you attach event handlers to them using .onMessage (I think, been a while). You can post and receive messages from ports (depending on type). Type checking is done at runtime to make sure nothing breaks. Cljs interop is easier (can just call a function directly).
- mgold 10y agoApparently a human-readable homoiconic language is still an unsolved problem... In 0.17, commands and subscriptions mean that, not matter how deep you nest components, you can still send and receive messages to/from the outside world (i.e. ports).
- christophilus 10y ago>> if it compiles, then it just seems to work This. I spent the first 14 years of my career in statically typed languages and only this year began working professionally on a Rails app... I really miss the compiler.
- shrugger 10y agoYou might be interested in the Crystal language. It's a statically-typed, Object-oriented, Ruby inspired language. It's Ruby with types, basically. You might also be interested in Elixir which ties in to the Erlang ecosystem, but if you are super into OOP (like me) you might find it slightly more difficult, but since you have experience with static-types, you probably know some FP stuff, and so it's not that bad. Either way, best of luck. It takes a brave soul to fight with Rails. I've been writing Ruby for about three years now and still haven't touched Rails just because I can imagine how little fun it is to try and debug dynamic-typed web stuff. Noooooo thanks.
- brightball 10y agoIt's odd how people are in their perspectives on static vs dynamic. I can't for the life of me understand how people tolerate static typing on the web. Every time I've tried it the experience has been so tedious. I just figure, everything is coming in as a string no matter what. It's going back out as a string. The only place it needs to be anything other than a string is something interesting is being done with it and since dynamic typing lets you just worry about it in those cases, it removes a lot of unnecessary code. On the flip side, outside of web work i can't imagine the reverse.
- appsappsapps 10y agoWhat typed languages have you used and what aspects do you find tedious? I find that the experience of writing brittle type-checking logic and tests in dynamic languages is rather tedious in its own right.
- 10y ago
- sridca 10y ago> if it compiles, then it just seems to work That's exactly been my experience with Elm. For example, on a web project I had been working on I decided to add the 'search' feature; the very first change[1] actually worked! This is generally not possible with JavaScript. [1] https://github.com/srid/chronicle/commit/4a6c18147bf1596b23436ba9dd8f77aba7a61486 https://github.com/srid/chronicle/commit/4a6c18147bf1596b234...
- jrcii 10y agoWhenever I write a bunch of code that works right away I'm highly suspicious that I'm missing something.
- desireco42 10y agoThank you for this endorsement. I am learning Elm, I like it a lot so far, but there are times where I question if this is really all necessary. So first person experiences like yours help me continue and understand where I can be if I continue on the path I am. Also, I would like to add that I really liked Signals and felt that they are good abstraction, but looking at Subscriptions and they also on surface level make sense.
- pdamoc 10y ago> I have found the whole Elm experience quite mindblowing; if it compiles, then it just seems to work. My mindblowing experience was facilitated by referential transparency where I had a page of code that became half a page after extracting some functions and restructuring the code and then have that half page collapse into several lines of boring code because I realized that the functionality can be re-expressed in terms of standard functions. It is amazing to be able to think about an entire branch of code in isolation and be able to understand it in its entirety.
- cwilkes 10y agoCare to share more about that? It would be really helpful for people looking at the language to see your progression. Could be something as simple as a gist with the code in your different stages.
- pdamoc 10y agoI tried to look through the commits of that project but could not find something that captures this. Maybe it happened between commits. Maybe I'm remembering it wrong. Maybe my mind exaggerated the memory. It happened last year while I was implementing Challenge No. 5: https://github.com/pdamoc/elmChallenges https://github.com/pdamoc/elmChallenges
- frostymarvelous 10y agoI came across it researching time travelling debuggers to implement in my flux implementation for android. My mind was blown but never really got enough time to study it since it was low on my priority list. I think you just pushed it to #2!
- mrcactu5 10y agoDid I read correctly that you are using Elm with Cordova? Perhaps you are using Elm to compile to HTML / CSS / JS which Cordova compiles to native code?