Re:The Great CoffeeScript to Typescript Migration of 2017
by jrumbut on Friday May 15, 2020 @10:31PM
(#23199972)
Unless is hugely valuable to me, "do x unless y" is great when x should happen in almost all cases.
It avoids the noise of if statements, I really miss it in languages that don't have it.
Re:The Great CoffeeScript to Typescript Migration of 2017
by jbergknoff on Friday May 15, 2020 @11:18PM
(#23200202)
I have a really hard time parsing `unless`. Whenever I encounter it in Ruby or CoffeeScript code, it takes me 10-30 seconds to stop and understand what's happening with the code.
Generally, postfix conditionals are a bad idea because they are garden-path sentences [1] by design.
Glad you find them valuable, but IMO they epitomize what many other comments in this thread have said about CoffeeScript's poor readability.
Re:The Great CoffeeScript to Typescript Migration of 2017
by st1ck on Saturday May 16, 2020 @09:17PM
(#23208604)
I don't see anything common in structure between postfix `unless` and examples of garden-path sentences, which seem to be based on word ambiguity. Nothing is ambiguous in e.g. `print(x) unless x != 0`. Although admittedly without syntax highlighting, conditionality it's less obvious.
Re:The Great CoffeeScript to Typescript Migration of 2017
by jessaustin on Saturday May 16, 2020 @09:04AM
(#23203055)
You're right, coffeescript's refusal to use python's more sensible ternary idiom ('normal' if condition else 'abnormal') is strange, especially since it already has the useful trailing-if idiom ('normal' if condition).
My only bug bear about coffee was its lack of a concise ternary, but it’s use of is/or/unless worked well for me.
I’m a bit sad that my Coffee/Pug/Sass/Yaml stack is supported out of the box in fewer places than it was, all sharing principles of less punctuation, and for me, more clarity as a result, but community support is pushing me towards migrating back to vanilla JS. Glad that some features are coming across, but things like destructuring aren’t as powerful (no [first, middle..., last]). Will be happy to see nullish coalescing come over.
I think the typing thing is relevant for big teams, something I’ve had the luck of avoiding for the most part.