Hacker News new | ask | show | jobs
by Cushman 4226 days ago
Well, that's definitely the JavaScript I intended to create :) Is there a bug in my logic somewhere?

Edit: But that aside, to be fair, I'll readily agree that it is easy to mess up CoffeeScript's significant whitespace if you don't pay attention to it. For example, you add a multi-line callback to one of those single-line callbacks at your peril!

But the tradeoff is, no mismatched braces/parenteses. Personally, I find the warts are not that hard to avoid, and the overall impact on my productivity is positive.

1 comments

I guess he's referring to the implicit returns which are a pain in the neck to deal with.
Implicit returns are the norm in ES6's arrow functions. I use CoffeeScript for most of my personal coding, and I can think of exactly one situation where an implicit return got me in trouble. Generally, if you don't care enough about what your function returns to check it, then it's likely the calling function doesn't either, assuming you're familiar with the particular API you're working with.
In LiveScript there's syntax to explicitly omit any return value, it's just a function with !-> instead of -> for the arrow.
That's a question of perspective, I think-- if we're calling this function from somewhere, and we care about what it does, we need those returns.