decompose assignment #5

weepy opened this Issue Aug 11, 2010 · 8 comments

3 participants



[x,y] = [1,0]
{x} = [2]

named destructured_assignment. working for arrays


dont need this - hardly ever needed


I use them all the time. Some common cases I use a lot ..
[oldx, x] = [x, newx]
[a, b, c] = str.split('|')
[all, domain, path] = /https?:\/\/([^\/]+)(.*)$/i.exec(url)


well the great thing about kaffeine is that it's modular and so pretty easy to create a plugin to do just this.

let me know if you'd like to try and i can help u out.


Should work, since it works while unwrapping async calls:

e, result = asyncFunc! x, y, z

asyncFunc(x, y, z, function(_0, _1) { var e, result; e = _0, result = _1

But using normal calls does not work:

e, result = asyncFunc x, y, z

 var result; e, result = asyncFunc(x, y, z)

Both cases should be treated consistently.


Good point. It could be added if it proves sufficiently useful. Perhaps there's an ambiguousness here that you've picked up on. We could move to the move coffeescript style [e, result] = ?


I think that move would be good, since Firefox accepts that syntax already. It would be consistent with what people expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment