Dan Sugalski <[EMAIL PROTECTED]> wrote:
> The one question I have is whether we need to have a "call class
> method" operation that, when you invoke it, looks up the class of the
> object and redispatches to it, or whether class methods are just
> methods called on class objects.
The terms are misleading a bit here.
- a ParrotClass isa delegate PMC
- a ParrotObject isa ParrotClass
- a HLL class isa Parrotclass and a low-level PMC object
- a HLL object isa all of above
.sub _main
.local pmc class
.local pmc obj
newclass class, "Foo" # create a new Foo class
find_type $I0, "Foo" # find it's dynamic type number
new obj, $I0 # instantiate a foo object
obj."_meth"() # call obj."_meth"
class."_meth"() # and as a class method
end
.end
.namespace [ "Foo" ] # start namespace "Foo"
.sub _meth method
print "in meth\n"
self."_other_meth"()
.end
.sub _other_meth method
print "in other_meth\n"
isa $I0, self, "ParrotObject"
print $I0
print "\n"
.end
This prints:
in meth
in other_meth
1
in meth
in other_meth
0
leo