>From: Tom Christiansen <tchrist@alumni.cs.colorado.edu>
>Do you think there should be a UNIVERSAL::isa() function
>so that $obj->isa("thngiehtingie") would quickly and efficiently
>report whether $obj was derived from class "thingie"?
I've always resisted marches through @ISA, hoping we'd come up with
something faster or that if would never have to be done at all, but I guess
that fell apart when I said that "an object is an object is an object" is
sometimes insufficient in Perl.
I think we'd have to start at the beginning and fix sv_isa(). Then make
sv_isa() available as UNIVERSAL::isa(). I guess it's a march through
@ISA...ug.
I cringe when I think of all the calls to isa() that people will put in
their code. They'll probably even use it on $self, of all things. Oh yes,
load those modules up with isa() calls, unnecessary in most situations, then
wonder why the app is so slow. It is times like these when I wish Perl
supported pre/post -conditions with a compile-time switch to control them.
But, grinch that I am, I recognize that there are times when you do need to
know the implementation and ancestry of the object.
Dean
>Do you think there should be a UNIVERSAL::isa() function
>so that $obj->isa("thngiehtingie") would quickly and efficiently
>report whether $obj was derived from class "thingie"?
I've always resisted marches through @ISA, hoping we'd come up with
something faster or that if would never have to be done at all, but I guess
that fell apart when I said that "an object is an object is an object" is
sometimes insufficient in Perl.
I think we'd have to start at the beginning and fix sv_isa(). Then make
sv_isa() available as UNIVERSAL::isa(). I guess it's a march through
@ISA...ug.
I cringe when I think of all the calls to isa() that people will put in
their code. They'll probably even use it on $self, of all things. Oh yes,
load those modules up with isa() calls, unnecessary in most situations, then
wonder why the app is so slow. It is times like these when I wish Perl
supported pre/post -conditions with a compile-time switch to control them.
But, grinch that I am, I recognize that there are times when you do need to
know the implementation and ancestry of the object.
Dean