Stevan Little wrote:
> On Jul 11, 2005, at 9:16 AM, Ingo Blechschmidt wrote:
>>   Bar.isa(Object);        # true
>>   Bar.isa(Class);         # true
>>   Bar.isa(Foo);           # ? (my guess: false)
>>   Bar.isa(Bar);           # ? (my guess: false)
> I am not sure about this. I think that .isa as a class method should
> behave much as it does for an instance method. If we start supporting
> things like Bar.isa(Class) then we start exposing the soft underbelly
> of the meta-model to the outside world. Which IMO might not be a good
> idea.

ah, you mean there could be problems, when, for example, Bar is not
actually a Class, but a PersistentClass or something, and one tries to
check whether a given $obj is a class by using .isa? I.e.:
  my $obj = get_a_class_or_something_else();
  if $obj.isa(Class) {...}    # XXX

IIRC, Larry once said that Class is actually a role, so then both the
builtin standard class object and PersistentClass .does(Class), so this
shouldn't be a problem, because one should use .does anyway (or ~~).

So, to fix the above snippet:
  my $obj = get_a_class_or_something_else();
  if $obj.does(Class) {...}   # or
  if $obj ~~ Class    {...}


Linux, the choice of a GNU | There are no answers, only
generation on a dual AMD   | cross-references.  
Athlon!                    |

Reply via email to