Re:CoffeeScript: less typing, bad readability
by svachalek on Monday September 17, 2012 @03:42PM
(#4534454)
Feel so wrong in... CoffeeScript? Or JavaScript? I think ternaries and callbacks are both much cleaner in CS (with the exception of "callback, something-else" which does end up a little funky unless you add parens). Just naming a variable to return it seems a little wrong to me but you can always leave the "return" in. "Optional" is very different than "never use".
Re:CoffeeScript: less typing, bad readability
by viseztrance on Monday September 17, 2012 @03:56PM
(#4534532)
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.
Re:CoffeeScript: less typing, bad readability
by jashkenas on Monday September 17, 2012 @04:12PM
(#4534615)
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.`.
Re:CoffeeScript: less typing, bad readability
by viseztrance on Monday September 17, 2012 @05:26PM
(#4534978)
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.
Re:CoffeeScript: less typing, bad readability
by tiglionabbit on Monday September 17, 2012 @05:07PM
(#4534903)
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.
While nowadays I prefer coffeescript to js, I would rather have some syntactic sugar like scss is for css. I've looked into it but nothing has enough momentum to make me sure it will still be around in two years or so.
As a sidenote, while I mentioned I prefer CS, have you ever tried using a ternary operator? or pass a callback function in jquery (ex. the hover out event)? or just return "this". There are so many things that feel so wrong.