Re:CoffeeScript, a little language that compiles to JavaScri...
by jashkenas on Thursday December 24, 2009 @03:52PM
(#1014373)
a: 1
b: 2
obj: {
a: 1
b: 2
}
Quite right, and internally, both kinds of assignment compile into a CoffeeScript AssignNode. The latter is just tagged as occurring within an object literal. Having the commas be optional in multiline objects also helps make both kinds of assignment look identical.(And I'm calling it assignment because saying "binding" in JavaScript usually means that you're binding a function to a "this" context object)
Re:CoffeeScript, a little language that compiles to JavaScri...
by nir on Thursday December 24, 2009 @10:02PM
(#1014718)
Any chance you'll allow equal sign as well as colon? For all of us coders conditioned by years of programming to automatically use "="...
Looks beautiful, in any case.
Re:CoffeeScript, a little language that compiles to JavaScri...
by jashkenas on Friday December 25, 2009 @10:43AM
(#1015048)
Sure, why not. They can be interchangeable. It's in the latest commit, and will go out with the next release.
Re:CoffeeScript, a little language that compiles to JavaScri...
by nir on Friday December 25, 2009 @11:57AM
(#1015099)
Cool, thanks!
Re:CoffeeScript, a little language that compiles to JavaScri...
by j_baker on Thursday December 24, 2009 @03:52PM
(#1014375)
Erm... no, it's assignment. At least according to the documentation: http://jashkenas.github.com/coffee-script/#assignment
At any rate, I was just curious. To me,
x = 1
looks more intuitive than: x: 1
But that's just my personal preference.
Also, it's "binding", not assignment.