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
It evaluates and returns the value of the scoped variable x.
However, once we alter this example only slightly, x will not be in the scope of the evaluation:
(()=>{letx=42;return(void0,eval)('x')})()
Inserting this SequenceExpression causes the following error:
Error: x is not defined
Evaluating workspacejs:09f31940-1ac0-43c1-bce8-132469645c6c/lively-kernel.org/lively4/aexpr/unnamed_module_9dd25e73_9d6f_4e56_b07c_398481bb3c5f
Loading workspacejs:09f31940-1ac0-43c1-bce8-132469645c6c/lively-kernel.org/lively4/aexpr/unnamed_module_9dd25e73_9d6f_4e56_b07c_398481bb3c5f
Note, that we can still evaluate code not related to locally scoped variables:
(()=>{letx=42;return(void0,eval)('window')})()
Not only a SequenceExpression breaks scope lookup; same goes for assigning eval to a local variable:
(()=>{letx=42;letev=self.evalreturnev('x')})()
My current assumption is that the concrete syntax (the CallExpressioneval(code)) makes the local scope available in the evaluated code.
We may mitigate this issue related to Active Expressions by not rewriting a global assess to the eval function.
The text was updated successfully, but these errors were encountered:
Consider the following code as running example:
It evaluates and returns the value of the scoped variable
x
.However, once we alter this example only slightly,
x
will not be in the scope of the evaluation:Inserting this SequenceExpression causes the following error:
Note, that we can still evaluate code not related to locally scoped variables:
Not only a SequenceExpression breaks scope lookup; same goes for assigning
eval
to a local variable:My current assumption is that the concrete syntax (the CallExpression
eval(code)
) makes the local scope available in the evaluated code.We may mitigate this issue related to Active Expressions by not rewriting a global assess to the
eval
function.The text was updated successfully, but these errors were encountered: