4 ms·
Elm made me hate working with Javascript in my job, and the differente is brutal. I don't believe in silver bullet but this is the domain where Elm shines: fron
by G4BB3R 8y ago
Elm made me hate working with Javascript in my job, and the differente is brutal. I don't believe in silver bullet but this is the domain where Elm shines: frontend development. I love every aspect of it. Elm is a very simple language, generates very small assets with a really fast compiler, gives us guarantees of no runtime exceptions in production, easy refactoring (in JS it would be a nightmare), has a time travel debugger (that shows your application state in any given moment), nice compiler error messages, and an incredible architecture which inspired redux (TEA) but is much better and simpler. There are problems ofcourse, for example not every Web API is covered yet, but it's possible to use Js ports to communicate with Elm.
- pault 8y agoJust out of curiosity, how often do you use time travel debugging? I have redux dev tools and can use it on any of my apps, but I've never felt that it was more useful than the step debugger. The first time I set it up I thought "huh, cool" and then never used it again. There's also the issue of side effects like ajax requests that interact with the outside world.
- maaaats 8y agoI had the same problem with time-traveling in react/redux. Everything has to be in the store for it to work, and since it's hard to make reusable components using the store, some things often end up outside. Then time-traveling becomes buggy. But since it's impossible with side-effects in elm, you can always trust it there. I use it pretty often to jump between states. The UI is not as good as redux-devtools and as feature-rich, though, that part I miss.
- pault 8y agoWhat about ajax requests though? What if you are debugging a component that sends a DELETE request?
- maaaats 8y agoIt doesn't end up spamming requests the same way as in react, as there is no "componentDidMount" that can trigger side-effects. In elm it's just different states being rendered.
- pault 8y agoAh sorry, I didn't mean side effects in lifecycle methods, I meant DOM events like click, etc. If you click a button that deletes a resource on your API, there is no time traveling because the outside world doesn't time travel along with your debugger (unfortunately). :) You can isolate your side effects somewhere, but they still have to respond to actions/events/messages so if your time traveler dispatches actions you'll end up making duplicate requests.
- Skinney 8y agoI could be wrong, but I don't think Elm re-triggers side-effects when you go back in time. It just brings back the state as of that moment in time.
- G4BB3R 8y agoEverytime. If anything goes wrong I just see the message (action in redux) and see the current state in that time, so I can understand what happened. In some cases it is more effecting than sending a log.
- pault 8y agoAh, I see. I use a customized redux logger that shows the before/after state and the action payload. That is what I've always used for trying to diagnose bugs so I've never found a reason to use the time travel tools.