Patrick R. Michaud wrote:
Yes, the translation helps a lot.
OK, good.

But what you came up with is almost exactly what I would expect PCT/Rakudo to be generating _now_ for this code example (modulo a few minor details).
I tried to write it so it wouldn't be far off what Rakudo would produce for a translation of that Perl 5 into Perl 6. But I'm not convinced that we always take clones on referencing a block in Rakudo (OK, I've not gone and looked, but I can't remember seeing anything that explicitly does that, and I spend a lot of time staring at Rakudo... ;-)).

So I'm still left without a good PIR counterexample that shows that PCT as presently designed will generate code that won't work. :-(
Do you have any good non-PIR examples (e.g. failing stuff in Perl 6)? Or am I missing the point (which, at 3am, is very possible...)

Note that this doesn't give any great answers yet about what happens when we do newclosure on a multi, but I think we can make that do something sane (snapshot the lot, perhaps? Need to think about what falls out of that...)
This is one of the possible advantages of the 'capture' approach
proposed previously -- we can ensure that the capture operation
always comes directly from the outer sub, so when iterating through
the Closures in a MultiSub it's easy to determine which ones need
a capture without having to chase up the caller chain for each one.
No, no. I'm thinking if we take a reference to an undisambiguated multi...then we have to newclosure it (clone it) as we take a reference...well, I guess then it just populates its clone to the closures too. But we'd not want to close non-closures, I guess. So, hmm...

Sleeeeeep!

Jonathan

Reply via email to