in reply to Re: Calling chains, extends, and subclassing
in thread Calling chains, extends, and subclassing

The alias deal doesn't seem to be an apt suggestion for a few reasons,
  1. It would require me to subclass all three packages, rather than just the select ones I wanted to subclass
  2. Even if I wanted to subclass the three modules, unless subclass exported and poluted the namespace of every other package (superclass), it would seem as if I would have to have totally redundant code
So now in the subclass, I would have something like
##Non redundant code
use aliased 'NHB::QuizMaster::Custom::NHMCCD::Question';

##Totally redundant code
sub new_question {
  my $self = shift;
  my $question = new Question( @_ ); Question->new(@_);

  push @{ $self->questions }, $question;

  $question;
}

I'm guessing that the alias doesn't affect the superclass



Evan Carroll
www.EvanCarroll.com
  • Comment on Re^2: Calling chains, extends, and subclassing

Replies are listed 'Best First'.
Re^3: Calling chains, extends, and subclassing
by diotalevi (Canon) on Oct 04, 2006 at 15:53 UTC

    You said "new Question" which you already know is ass. Don't be an idiot, don't do that.

    aliased isn't a structural thing - it means you don't have to use long class names in your code. It doesn't solve any subclassing or other interface problems. I suggested that you trash your entire idea to do @ISA evil and get to nirvana through syntactic sugar.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Please do tell me how Syntactic sugar eliminates the need to statically type the class, or how I can accomplish that. (And I am thankfull that Alias would make it shorter, but I'm aiming for non-existant here) I really don't want to have to override a sub just for a new statically typed class)


      Evan Carroll
      www.EvanCarroll.com