Skip to content

Instantly share code, notes, and snippets.

@tomdale
Created November 27, 2011 06:39
Show Gist options
  • Save tomdale/1397099 to your computer and use it in GitHub Desktop.
Save tomdale/1397099 to your computer and use it in GitHub Desktop.
SC.Object.extend
name: SC.attr 'string', { option: 'foo' }
SC.Object.extend({
name: SC.attr('string')
}, {
option: 'foo'
});
SC.Object.extend({
name: SC.attr('string', { option: foo })
});
@marcolz
Copy link

marcolz commented Nov 27, 2011

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.

@TrevorBurnham
Copy link

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.

@TrevorBurnham
Copy link

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