coffee-script icon indicating copy to clipboard operation
coffee-script copied to clipboard

Destructuring Assignment default value backward compatibility with coffeescript broken

Open vird opened this issue 9 years ago • 2 comments

{
  interval
  mod = 0
} = opt

coffeescript 1.10.0

var interval, mod, ref;

interval = opt.interval, mod = (ref = opt.mod) != null ? ref : 0;

iced 1.8.0-a (currently on http://maxtaco.github.io/coffee-script/)

Uncaught SyntaxError: unexpected =

serverside 108.0.9

error: unexpected =
  mod = 0

vird avatar Feb 05 '16 00:02 vird

I am thinking about moving all work to the iced3 branch, which requires generators ( or piping output through regenerator / Babel ). What are your thoughts?

On Thursday, February 4, 2016, vird [email protected] wrote:

{ interval mod = 0 } = opt

coffeescript 1100

var interval, mod, ref;

interval = optinterval, mod = (ref = optmod) != null ? ref : 0;

iced 180-a (currently on http://maxtacogithubio/coffee-script/)

Uncaught SyntaxError: unexpected =

serverside 10809

error: unexpected = mod = 0

— Reply to this email directly or view it on GitHub https://github.com/maxtaco/coffee-script/issues/171.

maxtaco avatar Feb 05 '16 15:02 maxtaco

Came here looking for destructured arguments defaults too.

I am a heavy user of iced-coffee-script and would support moving to iced3. Generators are supported in Node since v4 and I'd bet anyone using iced for frontend (like myself) already has a build chain where Babel would be easy to add.

Thanks to coffee-script and Iced, I'm not clamoring for generators or other ES6 features. I know the rest of the JS world is moving in that direction though -- so I think iced3 is the most sustainable way forward, and the simpler syntax and compatibility would help iced adoption.

doublerebel avatar Mar 30 '16 23:03 doublerebel