NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
only partial closure (Score:1)
{
my $x = 'default';
sub xify_foo {
my $foo = shift;
$x = $foo->$x(@_)
}
}
xify_foo needs to get more information from the stack, so it's not an entirely closed operation. Your explanation may apply in part, but I always thoug
rjbs
$foo isn't a free variable (Score:1)
In your example, xify_foo by itself has one free variable: $x. $foo isn't free in xify_foo: it's given by the caller. Hence, xify_foo only needs to close over $x. Technically (at least by my way of thinking when I wrote the journal entry), the xify_foo closure has all the memory space it needs: $x in the closure, and $foo on the stack. That is, of course, nit-picking.
This is the sort of thing I was handwaving about when I mentioned predicate logic. I suppose I should've gone into more detail. :-)
Reply to This
Parent