On 10/11/06, TSa <[EMAIL PROTECTED]> wrote:
HaloO,

with my idea of deriving a type lattice from all role definitions
the problem of subtyping signatures arises. Please help me to think
this through. Consider

role Foo
{
    sub blahh(Int, Int) {...}
}
role Bar
{
    sub blahh(Str) {...}
}
role Baz does Foo does Bar # Foo|Bar lub
{
   # sub blahh(Int&Str,Int?) {...}
}

Please, no attempts to merge signatures.  Instead, use multiple
dispatch (though technically this doesn't kick in until the role is
composed into a class).  Thus:

 role Foo
 {
     multi blahh(Int, Int) {...}
 }
 role Bar
 {
     multi blahh(Str) {...}
 }
 role Baz does Foo does Bar # Foo|Bar lub
 {
     # multi blahh(Int, Int) {...}
     # multi blahh(Str) {...}
 }

Remember that the name and the signature are used together to identify
the routine for dispatch and composition purposes.

Also, sub is an odd choice to use while illustrating role composition;
while subs _are_ allowed in roles AFAIK, they're generally not put
there.  Methods and submethods are by far more common.

--
Jonathan "Dataweaver" Lang

Reply via email to