➜ my $*a = 42; await start { say $*a }
42
➜ my $*a = 42; await start { await start { say $*a } }
Dynamic variable $*foo not found
IRC discussion (rearranged for clarity):
<smls> Are threads supposed to see dynamic variables declared in the
mainline prior to starting the thread?
<jnthn> A start block will go the extra mile to make that happen
<jnthn> It just takes the CALLER:: of whatever calls Promise.start iirc
<jnthn> But if you work directly with threads then every one has its
own fresh dynamic scope
...
<smls> Should that still work, when it's 2 levels deep into `start`?
<jnthn> Umm...I guess it'd be nice if it worked.
<jnthn> Can RT it; I don't see why we can't fix that.

Feels to me some kind of loop would need to be made around line 33 in src/core/stubs.pm, basically looping until we either find the dynamic variable, or look for a $*PROMISE in the context and if so, try to find it there?
Hope this made sense, too deep in other stuff now to try things out myself.
Show quoted text

Feels to me some kind of loop would need to be made around line 33 in src/core/stubs.pm, basically looping until we either find the dynamic variable, or look for a $*PROMISE in the context and if so, try to find it there?

Hope this made sense, too deep in other stuff now to try things out myself.