develooper Front page | perl.perl6.language | Postings from July 2005


Thread Next
Stevan Little
July 5, 2005 19:15
Message ID:
Again with the metamodel stuff :P

So, I am trying to implement the submethods correctly, and some 
questions occurred to me.

The concept of non-inherited infrastructural methods is fairly simple 
to accomplish in the meta-model, by just giving submethods their own 
dispatch table inside the metaclass. However where I am somewhat 
confused is in how and when they get called.

Take this example for instance:

class Foo {
	method bar () { ... }
	submethod bar () { ... }

Is this an error (Synopsis 12 seems to indicate it is *not* an error)?

When I call bar() on an instance of Foo, which is called? The method? 
or the submethod? Is it somehow dependent upon the calling context? 
(called from within the class, or from outside the class). Take for 
instance, this example:

class Foo {
	method bar () { ... }
	submethod bar () { ... }

	method baz ($self:) {
		$ # which one does this call?

Or are both called? if so, in what order? On method resolution, should 
I first check the submethod table? or the method table (and on up the 
superclass chain)?



Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About