At 11:44 AM 6/25/01 -0700, David Whipp wrote:
>When you blass an object in Perl, you give it exactly
>one type. The @ISA variable allows that type to refer
>to many other classes as the inheritance tree. @ISA
>is a list, but ref($obj) isn't. This means that you
>sometimes have to create a lot of useless classes to
>work around this limitation.
>
>A simple example: Imagine you have a class "Person".
>A Person can be Male or Female. Thats one set of
>subclasses. But a Person can also be Employed or
>Unemployed. So I might want to say
>
>    bless $self, qw(Employed Male);
>
>In Perl5 I am forced to create 4 new classes:
>Employed_Male, Employed_Female, Unemployed_Male,
>Unemployed_Female. The combinatorial explosion can,
>well, explode! The other standard solution is to
>add a "Person has-a Employment_Status" relationship,
>but that doesn't feel much better. Its just another
>way of programming round a weakness in the object
>models of most mainstream languages
>
>Can anyone see any problems with making C<bless> and
>C<ref> work with lists? C<isa> is not effected. We
>might want some magic to ensure 'ref($foo) eq "bar"'
>still works as expected.

What's wrong with multiple inheritance?
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com

Reply via email to