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.


Dave.
--
Dave Whipp, Senior Verification Engineer,
Fast-Chip inc., 950 Kifer Rd, Sunnyvale, CA. 94086
tel: 408 523 8071; http://www.fast-chip.com
Opinions my own; statements of fact may be in error. 
 

Reply via email to