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.
  • because they can be either an interface

    role Shootable {
            requires qw(ready aim fire);
    }

    or a Mixin

    role Shooting {
            requires qw(ready);
            method aim (Object target) { ... }
            method fire () { ... }
    }

    or something else entirely …

    role Gun with Shooting {
            has gun => (
                    is => 'Gun',
           

    • I thought a Role was a Mixin. :) But I'd say in this case, it depends on how you use it. Kind of like how an abstract class which implements no methods at all is still an interface, even though it might not be called one.

      --
      J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
      • Nah, Mixin inheritance isn't as safe as Role composition. Mixin's can cause diamond patterns in your inheritance, Roles can't (amongst other things).

        • I clearly still have a lot to learn, then. :)

          --
          J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers