Re:The Great CoffeeScript to Typescript Migration of 2017
by baddox on Friday May 15, 2020 @05:33PM
(#23197726)
In my view, the primary advantage of CoffeeScript was to provide ways to avoid JavaScript footguns. I think that a combination of ES 2015 and wider propagation of best practices have made many such footguns avoidable in practice without using CoffeeScript.
[ Parent
| on HN ]
Re:The Great CoffeeScript to Typescript Migration of 2017
by city41 on Friday May 15, 2020 @05:49PM
(#23197891)
But it brought along its own footguns. The article has one example
> For example, we had a major production bug in the fall of 2013 due to a misplaced space character.
Re:The Great CoffeeScript to Typescript Migration of 2017
by agency on Friday May 15, 2020 @06:19PM
(#23198181)
Definitely my experience. Implicit returns are just a breathtakingly bad idea and I have personally witnessed them cause countless bugs.
Re:The Great CoffeeScript to Typescript Migration of 2017
by city41 on Friday May 15, 2020 @06:30PM
(#23198282)
I think they can be ok in a language where it’s been well thought out. Like implicit return in clojure has never bugged or surprised me.
Re:The Great CoffeeScript to Typescript Migration of 2017
by sullyj3 on Saturday May 16, 2020 @02:41PM
(#23206004)
Interesting, I've never heard complaints about implicit returns before. I really enjoy them in languages like rust. What kind of bugs?
Re:The Great CoffeeScript to Typescript Migration of 2017
by agency on Tuesday May 19, 2020 @12:43PM
(#23236973)
I recall several resulting from the fact that lodash's _.forEach terminates iteration early if the function you pass it returns a falsey value for any element. Most people (myself included) weren't aware of this functionality and thought of the callback as a void function and weren't even thinking of what the last expression in it would evaluate to.
Re:The Great CoffeeScript to Typescript Migration of 2017
by sullyj3 on Sunday May 24, 2020 @12:24PM
(#23292580)
That just seems like a poor choice of api design for forEach, rather than a fundamental problem with implicit returns.
Re:The Great CoffeeScript to Typescript Migration of 2017
by acdha on Friday May 15, 2020 @05:57PM
(#23197980)
That matches my experience: the pitch was writing less, safer code but I found that JSHint (back then) had a comparable effect without a stop-the-world migration and a lot of the size reductions weren’t significant compared to following any style standards for naming, comments, etc.