Stories
Slash Boxes
Comments
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Or make every 'my' inside a class definition be an instance variable ...

    --Nat

  • Yes I know I should wait for Perl 6, blah blah blah, but I have reasons for doing this so don't try and persuade me not to

    Why should you wait for Perl 6? Perl 5 is a perfectly viable platform for such experiments. I expect Perl 6 to arrive eventually and be worth moving to, but many people are still skeptical. Skeptical or not, the Perl 6 development effort ignited some spectacular development fireworks in the world of Perl 5, and we're all reaping the benefits. If you have ideas, don't let anyone

    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
  • I've ranted a few times on Perlmonks [perlmonks.org] when people get "closure" and "anon sub" mixed up.

    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.

    --
    • Randal L. Schwartz
    • Stonehenge
    • Yes, but contrary to what #london may be claiming, both of Matts samples represent closures. :) Just check against Damians definition!
      • Right. The examples at the top of this thread are named subroutines that are closures. Similar to this: 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.
        --
        • Randal L. Schwartz
        • Stonehenge