Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks!

> everything is straight forward to write the elm way.

Same could be said for React and Angular I guess; but mainstream drama is easily forgotten. :)



Yes, but in React for instance, you could always do something "dirty" if you want. Like adding a class to some random parent element when a modal is showing from within deep down in the component tree, and remove on unmount, and also trigger a google analytics event.

In elm, the GA event is a side effect, so it has to come from your update function, using a port out to JS. So it has to be triggered by the same conditions showing your modal. Sometimes that leads to that logic being duplicated.

And the modal either the same to trigger some js code to set the class, or set a value on your main model somewhere and edit the render function of that specific element to take the new classname into account (so have to modify some other part of the code).

Of course, it leads to maintainable code with little surprises. But at a cost of a stricter way to do it.


I say this as someone who adores Elm and has used it in production twice: React et al. have escape hatches that Elm by design doesn’t.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: