Re:Dropbox dives into CoffeeScript
by jaggederest on Thursday September 13, 2012 @05:42PM
(#4518803)
The situation where it matters is with a trailing function argument, i.e.
Instead of
Those trailing parens are ugly, and they're very common if you do event-oriented javascript via closures.
[ Parent
| on HN ]
Re:Dropbox dives into CoffeeScript
by stickfigure on Thursday September 13, 2012 @06:03PM
(#4518887)
This is why our codebase uses paren-less calls when there is a trailing function argument, but uses parens in all other cases. It makes the code far, far more readable.
Re:Dropbox dives into CoffeeScript
by jaggederest on Thursday September 13, 2012 @08:14PM
(#4519355)
I agree, but I think making it a language restriction would be very odd. Coming from ruby, I also tend to think that this might be a nice way to do it, for things taking a final optional callback argument.
$.ajax('path', options) (data) ->
# do something with the data
But it does read less clearly, unfortunately.