5 ms·
What if you want to change the first item of a list? If you're going for smallest diff (which I'm not even convinced is a worthwhile consideration in language d
by akio 10y ago
What if you want to change the first item of a list? If you're going for smallest diff (which I'm not even convinced is a worthwhile consideration in language design), then allover's example is clearly superior to Elm's current convention.
- Tehnix 10y agoThe comma first is not with language design, it's a convention from FP langs (at least Haskell). >What if you want to change the first item of a list? Html.program { view = view , update = update } to Html.program { view = newView , update = update } Leading comma vs allow a non-terminating comma both leads to the same diff of just the one line. I mean, there are quite a bunch of languages that don't support non-terminating commas, which is really a bit of parsing that hides intent. Other than that, bashing a language for having the convention (that is not forced by the language but by... convention) is quite ridiculous. The HTML comment is a valid point to raise, but there is quite a good reason for having it be native Elm, which brings a ton more benefits than having JSX'esgue syntax.
- akio 10y agoI meant what if you wanted to add a new item to the front of a list or change the order of items in the list. [ 1 , 2 , 3 ] to [ 0 , 1 , 2 , 3 ] diff - [ 1 + [ 0 + , 1 , 2 , 3 ] > Other than that, bashing a language for having the convention (that is not forced by the language but by... convention) is quite ridiculous. It is forced slightly by the language as trailing commas are currently invalid syntax (though this is on the roadmap to be fixed). It's also more than just a convention, as it is explicitly recommended in the official Elm docs.
- deleted 10y ago[deleted]
- always_good 10y agoNobody has mentioned it, but in this sort of language, you're chaining expressions onto the right-hand side. Putting commas on the left-hand side means they're out of your way once and for all. The versioning diff argument is much less interesting. Most people don't care about that.