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.
  • ... and that's not a good thing. How can you tell by looking at a variable name whether it's a lexical or an instance or a class variable?

    Twigils help in Perl 6.

    • In Perl 6, how do you tell by looking at a method name the difference between an instance and class method? (Well, internally it's easy, but externally, not so much. This is a problem with most programming languages.)

      Aside from that minor quibble, I do agree with your point. Being able to easily disambiguate between these cases is important and relying on convention can be difficult. Programmers who don't grok OO will do stuff like this and then complain it's broken:

      my $x;

      class Foo isa Bar, Baz {
        our $y; # class variable

        sub method {
          # note no $self in here - we don't need it
          $x = 1;
          $y++;
          SUPER::method(@_);
        }

      };

      And how does a subclass grab $x and $y? There would need to be more sugar added. Still, if this is significantly faster, I'd be tempted. It might be better than nothing.