CoffeeScriptRedux icon indicating copy to clipboard operation
CoffeeScriptRedux copied to clipboard

Combination of splats and array destructuring in function arguments doesn't work

Open dustyburwell opened this issue 11 years ago • 0 comments

I recently came across a pattern in code that worked in CS but appears to fail in CSR.

myfn = (a, [b, c...]...) ->
  ...

It's an odd syntax for sure. It appears to effectively treat all arguments after the first one as an array, then destructures the array into a head and tail. I've found a couple of syntaxes that have the same net effect:

myfn = (a, b, c...) ->
  ...

and

myfn = (a, b...) ->
  [b, c...] = b
  ...

Given there are valid, and yet more readable, syntaxes available it may not be worth fixing this regression. But it's at least worth noting that the syntax is no longer supported.

For what it's worth, the error message reported by CSR is: Object #<Object> has no method 'instanceof'

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

dustyburwell avatar Jan 14 '14 19:01 dustyburwell