Slash Boxes
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.
More | Login | Reply
Loading... please wait.
  • Do you also want using 'sub foo {...}' to override a superclass method to be a compile-time failure or warning?

    If not, why treat it differently than overriding a role method, other than one's comparative level of experience and familiarity with inheritance vs. with roles?

    • Do you also want using 'sub foo {...}' to override a superclass method to be a compile-time failure or warning?

      Many language designers are now realizing that they need to be explicit in their code behavior. For example, here's a Java method which should override a parent class method.

      public int someObscureMethod() {
         return 1;

      What if the parent class method takes an argument? You've not overridden the method and you may very well get an extremely hard to debug error. Now you can find out at compile time that this method isn't really overriding anything. Here's the method in C#

      public overr

      • I think hdp was asking an honest, simple question. I think your answer is "yes, subclassed override should also warn if not marked," with added explanation. Is that correct?

        I have no strong feelings either way, although I'd rather all my existing code didn't go crazy with warnings. I just wonder what your opinion is on other forms of method occlusion or augmentation.

        • Yes, that was my intended answer. Many languages are moving to this, though I can see others resisting this idea.

          As for "other forms of method occlusion or augmentation", I expect you're referring to things like the "before", "after", "around", "augment" and "inner" features from Moose. "augment" and "inner" must go hand-in-hand, so that's immediately visible to the programmer no matter which of the augment/inner methods they see.

          The others are silent "action at a distance" but they have the advantage tha