DEV Community

Discussion on: Comparing Elm to Ember Octane and React

Collapse
 
eberfreitas profile image
Éber Freitas Dias

Hi Maciej,

Thank you so much for your comments! I have only a couple of things I want to comment on...

Yes, in JS generally there is no way to make such approach safe. But in TypeScript you can force compiler to check if all options were handled.

The keyword for me here is "can". In Elm, even if I have chosen to use plain strings for my messages I still would need to account for all of the possibilities, ultimately using a catch-all condition (maybe TS does that as well? I don't have any significant experience with it). Anyway, that is something that Elm will force me to do, I don't have the option not to and for me that is a major pro.

TS is a huge step forward from plain JS but TS alone won't prevent you from doing things that might hurt you in the future. Add to that the possibility of using the any type and things might derail pretty quickly. Despite the possibility of writing correct code, TS won't really prevent you from writing bad code at all and the beauty of Elm for me is that it makes really hard to do so.

Yes I know why, but for many such trade-off not pays of and I see the point.

Yeah, I think you are right. For me what clicked was the idea that I'm paying upfront a smaller price for something that could cost me much more in the future. So a few things might actually be cumbersome to deal with, but it pays off in the long run.