coffeescript icon indicating copy to clipboard operation
coffeescript copied to clipboard

implicit objects below function calls have been uncurried

Open Waquo opened this issue 16 years ago • 2 comments

While trying out "Writing DSLs" on the wiki (http://github.com/jashkenas/coffee-script/wiki/[Extensibility]-Writing-DSLs), I noticed that the example code doesn't work anymore.

The Code:

describe 'Whiskey'
  age: 18
  brand: 'Jack'

now yields

describe('Whiskey', {
  age: 18,
  brand: 'Jack'
});

whereas the wiki indicates that it used to compile to the curried

describe('Whiskey') ({
  age: 18,
  brand: 'Jack'
});

Was this changed intentionally? I prefer the curried version, because it allows easy variable length parameter lists. One could always add a comma to get the uncurried version, or is this too subtle and error-prone?

describe 'Whiskey',
  age: 18
  brand: 'Jack'

Waquo avatar Sep 17 '10 16:09 Waquo

Odd, at the time of writing the Wiki article I was using 0.9.2. I wonder what introduced this in 0.9.3 and if it's here to stay I am happy to rework the Wiki pages.

StanAngeloff avatar Sep 17 '10 22:09 StanAngeloff

It's here to stay -- the previous parse was an unexpected side effect of having implicit object literals. It would be great to rework the wiki page, and the new 0.9.3 parse should make writing that particular DSL even easier.

There isn't a ticket for this, but sstephenson brought it up on #coffeescript.

jashkenas avatar Sep 18 '10 02:09 jashkenas