I wanted to make sure this question had a chance to get addressed, so I am seperating it from the other thread which has digressed into the depths of the metamodel (much to my delight too).

So..., as described in the other thread, the following statements are true about the metamodel.

1) MetaClass is a subclass of Object
2) MetaClass is an instance of MetaClass

So the following code should be true (given a random instance $obj).


Because after all, the object returned from $obj.meta should be a MetaClass instance right?

However, Syn/Apoc 12 shows that the following is true if $foo is an instance of the Foo class.


And that $foo.isa(Foo) actually is just an alias for $foo.meta.isa(Foo).

So I am sure you can see my problem here.

The p5 prototype currently handles it as such:

  $foo->isa(Foo) # returns true if $foo is an instance of Foo
$foo->meta->isa(MetaClass) # returns true since $foo->meta returns a MetaClass instance
  $foo->meta->is_a(Foo) # returns true, note the added '_'

Personally I am not a fan of the 'is_a' name, I just did it one day, and it sort of stuck. But I do think we need to find a way to differentiate between the two questions:

- What class are you an instance of?
- What class are you describing?

The first question can be asked of anything which inherits from Object. The second question is really only relevant to MetaClass instances.

Thoughts, Comments, Suggestions?


- Stevan

Reply via email to