Reusing Codeblock
s between Context
s is not properly supported
#2626
Labels
Codeblock
s between Context
s is not properly supported
#2626
Describe the bug
Trying to run a
Codeblock
compiled by aContext
in a separateContext
causes a panic on runtime.To Reproduce
This uses the
main
branch of Boa, but it should be also reproducible from the latest released version.Expected behaviour
Either run correctly or throw an error saying that codeblocks cannot be reused on other
Context
s.Current behaviour
Build environment:
Additional context (no pun intented):
This is where the fun part begins. AFAIK, most engines support using codeblocks between contexts, but we don't support that because of two reasons:
Sym
s to internally represent variable bindings. This assumes that the containingContext
has on its interner the binding names used in the execution.Context
itself.To illustrate the second point, this code correctly throws:
While this code runs and returns
5
:Discussion
Having said all of that, we have possibly two paths forward:
The text was updated successfully, but these errors were encountered: