Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destructuring into existing variables #3500

Closed
admosity opened this issue May 29, 2014 · 3 comments
Closed

Destructuring into existing variables #3500

admosity opened this issue May 29, 2014 · 3 comments

Comments

@admosity
Copy link

I find myself moving data around a lot in and out of already existing variables, and it seems that the only way to do so is having a series of assignment statements or destructuring first and looping over the new object/array to assign the values.

The proposed syntax would be:

existing.{one,two} = {one:1, two:2, three:3}

for object destructuring and:

existing.[ 0..1 ] = [1,2,3,4,5,6,7]

AND

existing.[ 0, 1, 5] = [1,2,3,4,5,6,7]

@connec
Copy link
Collaborator

connec commented May 29, 2014

More discussion of this idea can be seen at #3225 (and probably a few other places). I think it's a great idea, though your second last example exists (existing[0..1] = [1,2,3,4,5,6,7]) and your last example would make as much sense as an object de/restructuring (existing.{0, 1, 5} = [1,2,3,4,5,6,7]).

@vendethiel
Copy link
Collaborator

Thanks @connec :).

@admosity
Copy link
Author

Ah, knew it was there somewhere. Sorry for creating a dupe.

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

No branches or pull requests

3 participants