maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
728 stars 58 forks source link

Destructuring Assignment default value backward compatibility with coffeescript broken #171

Open vird opened 8 years ago

vird commented 8 years ago
{
  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
maxtaco commented 8 years ago

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 notifications@github.com 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.

doublerebel commented 8 years ago

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.