Make all local scope variables EXTERNABLE

Make all local scope variables EXTERNABLE (by attaching them to this._lastResult)

function MyFunc(a,b,c){
    b="0"
    c="Zero"
    let d=0x0    
    return 5
}
MyFunc({ val:0 },4,6,8) // 5
this._lastResult // { a:{ val:0 }, b:"0", c:"Zero", d:0x0, return:5 }

// so instead of PUSHING variables ONTO the RETURN stack explicitly, you can PULL variables FROM the return scope

Why is it supposed to be a property on whatever this points to? Also what is the usecase for this? And have you considered the performance impact this would have, given that no inlining can be done and all inner variables leak to the outside?

1 Like

I thought it was one the reason why we need scopes, to keep local variables at where they belong.

1 Like