On Fri, 14 Mar 2003 10:46:31 +0000, Larry Wall wrote: > If you say > > $foo.isa(Even) > > it doesn't just check to see if $foo is a member of class Int, but it also > checks the constraints on type Even, and returns false unless $foo is an even > integer. > > We could still call Even a class if we wanted to, but it seems useful to me to > distinguish classes that work "right" from classes that engage in hanky-panky. > I think of types as being "semi-instantiated". In a sense, this is currying of > classes.
Is isa() the right name? Distinguishing between type and class seems very useful. A type signature says "I want something that has these traits". Checking isa says "I want something that has this place within a class hierarchy." Attaching type information to a class makes sense -- you've got downwards substitutability there, but checking "is it this class or a descendant" when all you really mean is "does it have these traits" is way too specific and prevents a lot of substitutability. It's a subtle distinction. Allomorphism, anyone? -- c