PythonMonkey
PythonMonkey copied to clipboard
Wrong lexical scope for pmjs evaluation
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.
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
@caleb-distributive let's revisit now that https://github.com/Distributive-Network/PythonMonkey/issues/84 is solved
See also https://dstrbtv.slack.com/archives/C03RNFRL4NQ/p1722616586684009?thread_ts=1722528772.069329&cid=C03RNFRL4NQ