LambdaS5 icon indicating copy to clipboard operation
LambdaS5 copied to clipboard

Improper handling of compound assignment

Open tilk opened this issue 10 years ago • 0 comments

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.

tilk avatar Aug 04 '15 14:08 tilk