decompose assignment #5

Open
weepy opened this Issue Aug 11, 2010 · 8 comments

3 participants

@weepy
Owner

like

[x,y] = [1,0]
{x} = [2]
@weepy
Owner

named destructured_assignment. working for arrays

@weepy
Owner

dont need this - hardly ever needed

@ghost

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)

@weepy
Owner

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.

@akidee

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.

@weepy
Owner

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] = ?

@benekastah

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

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