in reply to (tye)Re: A question of inheritance
in thread A question of inheritance

Says tye:
> ...even the ubiquitous @ISA=qw(Exporter) is
> an abuse of inheritance and causes problems.
I think it is the wrong approach to suggest changing all the modules that do this. It also fails to solve the larger problem, which is when class A inherits from class B, but B contains a private utility subroutine that you don't want to inherit.

People have been talking for a long time about a :method attribute for subroutines. If there were such an attribute, you could simply have a rule that says that only :method subroutines could be inherited. Then the right fix would be very simple: Just tag Exporter::import with the :method attribute.

Replies are listed 'Best First'.
(tye)Re2: A question of inheritance
by tye (Sage) on Nov 29, 2000 at 00:13 UTC

    I agree that a :method attribute would be a good thing and that inheriting utility functions is a problem.

    I disagree that switching the standard use of Exporter.pm from inheritance to importing wouldn't be a good thing (I'm not suggesting forcing all old modules to be switched to this new usage). Using inheritance to get the single import() method is a bit of a stretch and I still think it would be a problem even with a :method attribute.

    I wonder how hard it would be to get:

    use Exporter qw(import);
    to work? (Part of me say "easy, it probably already works" and part of me worries that that tunnel might be quite long and dark.)

            - tye (but my friends call me "Tye")