in reply to Re: "use base" or @ISA
in thread "use base" or @ISA

My module does NOT have an ISA relationship with Exporter!

Really? So, how would you explain the relationship? Your module exports; it is an exporter.

Replies are listed 'Best First'.
Re^3: "use base" or @ISA
by simonm (Vicar) on Aug 18, 2004 at 01:45 UTC
    My module does NOT have an ISA relationship with Exporter!

    Really? So, how would you explain the relationship? Your module exports; it is an exporter.

    I would say that the module "delegates to Exporter", or "uses Exporter".

    Delegation and composition are perfectly valid implementation mechanisms, and there's no reason to view inheritance as the one true way of sharing functionality.

      In Perl 6 terms, it "does" Exporter rather than "is" Exporter. That is, Exporter is a role rather than a class. (It's a form of composition, really.) The Exporter role in Perl 6 would presumably supply importation as a submethod rather than a method, so that it's not inherited by subclasses.

      It could also be done with delegation, but in that case it "has" an Exporter object.

      Of course, Perl 6 might not use an Exporter class or role at all, since the standard export mechanism will be built in, and (we hope) fast.

        I suspect Dallas.pm has already been written... (or whatever extension Perl6 roles use, or, in this case "roll"s)

        (If not, someone notify the DFW monks.)

        - tye        

Re^3: "use base" or @ISA
by ikegami (Patriarch) on Aug 17, 2004 at 17:34 UTC
    oops, that was a typo or a freudian slip or something. I meant to say my class isn't an exporter. A dog (for example) is an animal, but a dog isn't an exporter (although the package in which dog is defined might be). That's just my way of looking at things, so use the style you like the most.