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.
"closure" is not "anon sub" (Score:1)
A closure is any subroutine that needs to grab its environment because it's going out of scope, and may or may not be named.
An anonymous subroutine is a coderef, and may or may not be a closure.
I've got code to demonstrate all four types of subroutines (named vs anonymous, closure vs not) at Monks somewhere.
Re:"closure" is not "anon sub" (Score:1)
Re:"closure" is not "anon sub" (Score:1)
BEGIN { my @DoW = qw(Sun Mon Tue Wed Thu Fri Sat); sub DoW { my $n = shift; die unless $n == int($n) and $n >= 0 and $n That's definitely a closure and yet it's a named subroutine.Reply to This
Parent