Created
October 25, 2011 14:54
-
-
Save rentalcustard/1313015 to your computer and use it in GitHub Desktop.
Why I don't like coffeescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Given a function that accepts a callback... | |
someFunc = (callback) -> | |
#do stuff | |
callback(data) if callback | |
#when calling it... | |
someFunc (data) -> | |
#blah | |
#it's not clear until you see the '->' symbol that (data) | |
# is the list of arguments to the anonymous callback function | |
# rather than an argument to the someFunc() call. And even | |
# after you see it, there's only a single character difference | |
# between calling someFunc with a function and declaring a | |
# function called someFunc which accepts a function. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to reduce a general difficulty I have with reading (other people's) Coffeescript to its simplest form. I agree that putting parens around the call makes it (slightly) easier to read.
I'm looking at code that is callback heavy (probably too callback-heavy, but that's another story...) and I still find the 'arguments before function symbol' syntax highly confusing when nested inside a call to another function: