From: "Patrick R. Michaud" <[EMAIL PROTECTED]> Date: Fri, 11 Jul 2008 22:59:05 -0500
On Fri, Jul 11, 2008 at 08:00:40PM -0700, Bob Rogers via RT wrote: > Of course, if cloning works the same as newclosure than we don't > need an explicit newclosure for the examples given, because > assignment already makes a clone. > > Assignment seems to do assign_pmc, which for a closure invokes the Sub > method (there is no Closure method). Needless to say, Sub:assign_pmc > does nothing special to capture the current context; if that is NULL, > then "autoclose" takes over when the thing is called. You're _completely_ missing my point. If we follow my proposal to modify Parrot or code generation such that a capture operation is performed for closures at the beginning of every outer sub invocation, then by the time we get to an assign operation a closure would _already_ have its current context captured, so only a simple clone is needed (which is what assign normally does -- it makes a copy of whatever is being assigned). That's true. And if that was your point, I did indeed miss it. But, as I quoted you: . . . if cloning works the same as newclosure than we don't need an explicit newclosure . . . Which seems to say something entirely different. So I thought I should point out that cloning does *not* work the same as newclosure. (And I still don't understand the *point* of cloning a closure.) And again, under my proposal I've been saying (apparently ineffectively) that "autoclose" would be gone entirely, and invoking a Closure that hasn't already had its context captured (i.e, outer_ctx is NULL) will throw an exception. In other words, there's no chance that "autoclose takes over when the thing is called". Pm The paragraph before the one I quoted started with "At present ...", so I assumed you were still talking about the current implementation. Maybe we should both get some sleep. -- Bob