3 ms·
Not allowing parens would mess up the usage of anonymous functions.
by MatthewPhillips 15y ago
Not allowing parens would mess up the usage of anonymous functions.
- latchkey 15y agoNot sure I understand you or maybe you don't understand me. I was talking about using parens for method/functional calls, not getting rid of them from CS.
- MatthewPhillips 15y agoI understand. If you don't have parens on method calls, how could you use an anonymous function that is not the last parameter? For example: doSomething(-> # stuff happens ), onerror
- latchkey 15y agoI totally agree with you.
- jacobolus 15y agoFirst, your code snippet is wrong: you need a space before your first paren. In coffeescript you can do any of the following, or a few other variants: doSomething -> stuff , onerror doSomething(-> stuff , onerror ) doSomething (-> stuff ), onerror doSomething( -> stuff onerror ) doSomething (-> stuff), onerror
- Perceptes 15y agoI had this question a while back as well. Take a look at the discussion here, including Jeremy's thoughts: https://gist.github.com/1215863 https://gist.github.com/1215863