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

Destructure assignment optimization #1074

Open
determin1st opened this issue Oct 26, 2018 · 2 comments
Open

Destructure assignment optimization #1074

determin1st opened this issue Oct 26, 2018 · 2 comments

Comments

@determin1st
Copy link

determin1st commented Oct 26, 2018

For example, this expression:

{item1, item2} = o = new CustomObject!

compiles to this code:

ref$ = o = new CustomObject(), item1 = ref$.item1, item2 = ref$.item2;

but could be:

o = new CustomObject(), item1 = o.item1, item2 = o.item2;

as the new object is already assigned to o, additional reference variable is not needed.
do you agree?

@rhendric
Copy link
Collaborator

Yes, I think I do agree. We'll have to be careful, though, about cases like

{a: o, b} = o = f!

which still require the ref$ variable.

@determin1st
Copy link
Author

I'll be careful, i promise :]

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

2 participants