You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.
) We found that the "with" desugaring presented in the paper does not capture the implementation. The desugared "with" example in page 12 of the ECOOP 2010 paper is as follows:
function(x, obj) {
if (obj.hasOwnProperty("x")) { obj.x = 50 }
else { x = 50 }
if ("y" in obj) { return obj.y }
else { return window.y } }
but the corresponding implementation in DesugarWith.hs uses only the hasOwnProperty version not the "in" operator.
Moreover, the implementation does not preserve the ECMAScript semantics. Unlike [[HasProperty]], the hasOwnProperty method does not consider objects in the prototype chain. Therefore, the desugaring using the hasOwnProperty method does not preserve the ECMAScript semantics. For example, the following code:
var z = 50;
var cons=function(){
this.x=3;
this.y=2;};
var obj = {z:2};
cons.prototype=obj;
var newobj = new cons();
with (newobj) actual=z;
print(actual);
should print 2 according to ECMAScript, but the desugared code via LambdaJS prints 50. Note that both SpiderMonkey and JSC also print 2.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
) We found that the "with" desugaring presented in the paper does not capture the implementation. The desugared "with" example in page 12 of the ECOOP 2010 paper is as follows:
function(x, obj) {
if (obj.hasOwnProperty("x")) { obj.x = 50 }
else { x = 50 }
if ("y" in obj) { return obj.y }
else { return window.y } }
but the corresponding implementation in DesugarWith.hs uses only the hasOwnProperty version not the "in" operator.
Moreover, the implementation does not preserve the ECMAScript semantics. Unlike [[HasProperty]], the hasOwnProperty method does not consider objects in the prototype chain. Therefore, the desugaring using the hasOwnProperty method does not preserve the ECMAScript semantics. For example, the following code:
var z = 50;
var cons=function(){
this.x=3;
this.y=2;};
var obj = {z:2};
cons.prototype=obj;
var newobj = new cons();
with (newobj) actual=z;
print(actual);
should print 2 according to ECMAScript, but the desugared code via LambdaJS prints 50. Note that both SpiderMonkey and JSC also print 2.
The text was updated successfully, but these errors were encountered: