Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Those last things feel wrong in coffeescript. Honestly, what's more readable:

  x = a ? b : c
or

  x = if a then b else c
And for the last one:

  function() {
    // doing something
    return this;
  }

  ->
    # doing something
    @
Don't get me wrong, I love the fact that I can do nice stuff such as callback?() and some other nifty tricks, but while I'm still having fun using coffeescript, in my experience it's not that great as most people make it up to be.


Just FYI, using standalone `@` isn't considered to be good CoffeeScript style. It's discouraged for this very reason -- just use `this` instead.

The reason why it works in the first place is for consistency ... in every other context, you can use an `@` to replace a `this` or `this.`.


FYI, I usually use this instead of @ myself, but in this case I used @ to empathize a grander issue.

And it's not like there's a warning about it being removed on coffeescript.org where it's being mentioned as an alias for this in the first place.


I prefer words to symbols any day. I think coffee's ternary is better. Also, I have no problem throwing singular @s around cuz they're short and get used so often, but typing out 'this' would be fine too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: