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

Improper handling of compound assignment #62

Open
tilk opened this issue Aug 4, 2015 · 0 comments
Open

Improper handling of compound assignment #62

tilk opened this issue Aug 4, 2015 · 0 comments

Comments

@tilk
Copy link

tilk commented Aug 4, 2015

S5 desugars compound assignment (e1 += e2 etc.) to e1 = e1 + e2, which is invalid when the evaluation of e1 has side effects. Here is an example program that exhibits the problem:

    var o = {x: 0};
    function f() { o.x++; return o };
    (f()).x += 1

Complying implementations should give o.x == 2. S5 gives 3, because under the current desugaring, f() is called twice.

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

No branches or pull requests

1 participant