{
my $foo = 99;
CODE: print ++$foo, "\n";
}
goto CODE;
I don't think the above, or your original example, meet your or my definitions of a closure.
The variable bindings are not retained - because we don't get 100, 101, etc. That binding is an essential part of what a closure is all about.
Really, it's very similar to broquaint 's "named closure" example; only, the inner block is not a subroutine
I don't think it is because "named" closures retain the variable bindings of their scope they were declared in.
I do agree with you and broquaint that the Camel's definition is off. Closures and naming are separate concepts. It seems to be one of those things that Perl defines differently from the rest of the world :-) Why should a closure suddenly become something else if its assigned to a symbol table entry.
|