PythonMonkey icon indicating copy to clipboard operation
PythonMonkey copied to clipboard

Wrong lexical scope for pmjs evaluation

Open wesgarland opened this issue 2 years ago • 3 comments

Type ".help" for more information.
> const c=1
undefined
> c
ReferenceError: c is not defined
    @/home/wes/git/PythonMonkey/./pmjs line 118 > eval:1:1
    replEval@/home/wes/git/PythonMonkey/./pmjs:118:32
> var a=1
undefined
> a
1
> globalThis.a
1
> globalThis.c
undefined
> 

c should have been a property of globalThis, but wasn't. It's as though there is a {...} scope in the way, but I can't see how that would be.

wesgarland avatar Jul 14 '23 18:07 wesgarland

This is a side effect of using eval() to evaluate the code. pmEval would be better, but we can't use that due to issue #84

wesgarland avatar Jul 15 '23 02:07 wesgarland

@caleb-distributive let's revisit now that https://github.com/Distributive-Network/PythonMonkey/issues/84 is solved

philippedistributive avatar May 16 '24 15:05 philippedistributive

See also https://dstrbtv.slack.com/archives/C03RNFRL4NQ/p1722616586684009?thread_ts=1722528772.069329&cid=C03RNFRL4NQ

philippedistributive avatar Aug 02 '24 17:08 philippedistributive