> From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>
>
>
>Hmm. I think there's a (possibly intentional?) semantic split occurring here.
>I think we need to make a clear distinction between 'type' and 'class'. I
>realize that's anathema in the pure OO paradigm, but Perl's not pure OO, and I
>think that these concepts are (mostly) orthogonal in Perl. 'Type' is an
>attribute that's defined in Perl's internals, while 'class' is at the
>programmer's disposal. 'Type' is used to determine how to allocate a value,
>and what intrinsic operations can be performed on that value. 'Class' is used
>to determine where to find a function associated with that value.
I agree with Charles on this one. In Perl we have to distinguish between
class (I usually call it "subtype") and implementation type. We cannot say
"an object is an object is an object". We have to know that the object was
implemented as an AV or an HV or some other Perl-internal type.
As an example, my XS typemaps check appropriate combinations of
SvROK/is_object/SvTYPE and don't worry about subtype. This ought to be
enough to help avoid accidents.
Dean
>
>
>Hmm. I think there's a (possibly intentional?) semantic split occurring here.
>I think we need to make a clear distinction between 'type' and 'class'. I
>realize that's anathema in the pure OO paradigm, but Perl's not pure OO, and I
>think that these concepts are (mostly) orthogonal in Perl. 'Type' is an
>attribute that's defined in Perl's internals, while 'class' is at the
>programmer's disposal. 'Type' is used to determine how to allocate a value,
>and what intrinsic operations can be performed on that value. 'Class' is used
>to determine where to find a function associated with that value.
I agree with Charles on this one. In Perl we have to distinguish between
class (I usually call it "subtype") and implementation type. We cannot say
"an object is an object is an object". We have to know that the object was
implemented as an AV or an HV or some other Perl-internal type.
As an example, my XS typemaps check appropriate combinations of
SvROK/is_object/SvTYPE and don't worry about subtype. This ought to be
enough to help avoid accidents.
Dean