Re:CoffeeScript: less typing, bad readability
by viseztrance on Monday September 17, 2012 @03:15PM
(#4534312)
I haven't used CS as much as yourself, but I don't find anything pretty in "element = =>".
Re:CoffeeScript: less typing, bad readability
by deanotron on Monday September 17, 2012 @06:02PM
(#4535145)
That is a good example, and something that is eased by syntax highlighting (although I rarely implement double-bar function literals, keeping a pythonic 'self = this' reference is preferrable in most cases)
Although it is all subjective aesthetics, CS shines when paired with underscore.js, and really all "callback-as-last-argument" paradigms, ie:
_.each items, (item) ->
# do stuff with item
# ...
(edited formatting, also what alec said below :)
Re:CoffeeScript: less typing, bad readability
by alecperkins on Monday September 17, 2012 @05:40PM
(#4535039)
If you use anonymous functions a lot, it's amazing:
result = _.map object, (val, key) ->
foo(val)
is much cleaner than var result = _.map(object, function(val, key) {
return foo(val)
});
I think.
I just want to throw out a positive experience with it and to say that I don't support the author's premise of "here's some misleading things you can do with CS, therefore CS is unreadable". This applies to all languages, and 'fanciful' features and syntax should be avoided almost always in every language for the sake of readability.
There are MANY reasons not to use coffeescript, but JS is all functions all the time, and -> is my best friend.