Hello,

More questions for the metamodel. I am trying to add proper submethod and private method handling and I have a question about method resolution order as a whole. I asked a similar question last week, but this time I have more details :)

Given this class:

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

and given this code:

Foo.new().bar()

What should happen?

The Syn/Apoc seem to indicate that methods and submethods of the same name can coexist. So the class definition itself is legal. However, it brings up an issue when it comes time to call bar().

Should submethod bar() be called first, then method bar() after it?
Should method bar() be called first, then submethod bar() after it?

Can submethods only be called from within the class (like private methods)?

And if submethods can only be called from within the class, then how do I handle this:

class Foo {
        submethod bar { ... }
        method bar { ... }
        method baz {
                $?SELF.bar()
        }
}

Foo.new().baz()

Thanks,

Stevan


Reply via email to