Created
November 27, 2011 06:39
-
-
Save tomdale/1397099 to your computer and use it in GitHub Desktop.
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
SC.Object.extend | |
name: SC.attr 'string', { option: 'foo' } |
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
SC.Object.extend({ | |
name: SC.attr('string') | |
}, { | |
option: 'foo' | |
}); |
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
SC.Object.extend({ | |
name: SC.attr('string', { option: foo }) | |
}); |
What's more alarming is that
name: SC.attr 'string', { option: 'foo' }
is, by itself or in a class body, a parse error. The trouble is that unbraced object literals passed to functions are parsed differently than unbraced object literals elsewhere. There are several open issues related to this, and kinks will continue to be worked out for some time.
I've posted an issue for this: jashkenas/coffeescript#1896
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like the exact kind of ambiguities one can have in Ruby. And the reason why many Ruby programmers suggest to use brackets all the time. Maybe that should be the case in CoffeeScript too.