Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

choice of signatures

0 views
Skip to first unread message

Jonathan Lang

unread,
Jan 4, 2006, 4:34:31 AM1/4/06
to perl6-language@perl.org List
Instead of

multi sub *infix:<~>(ArabicStr $s1, ArabicStr $s2) {...}
multi sub *infix:<~>(Str $s1, ArabicStr $s2) {...}
multi sub *infix:<~>(ArabicStr $s1, Str $s2) {...}

could you say

multi sub *infix:<~>(ArabicStr $s1, ArabicStr | Str $s2) | (Str
$s1, ArabicStr $s2) {...}

or something to that effect?

--
Jonathan "Dataweaver" Lang

Fayland Lam

unread,
Jan 4, 2006, 8:52:14 AM1/4/06
to perl6-l...@perl.org
Jonathan Lang wrote:
> Instead of
>
> multi sub *infix:<~>(ArabicStr $s1, ArabicStr $s2) {...}
> multi sub *infix:<~>(Str $s1, ArabicStr $s2) {...}
> multi sub *infix:<~>(ArabicStr $s1, Str $s2) {...}

as S13 say

multi sub infix:<+> (Us $us, Them $them) is commutative {
myadd($us,$them) }

Miroslav Silovic

unread,
Jan 4, 2006, 10:26:51 AM1/4/06
to fay...@gmail.com, perl6-l...@perl.org
fay...@gmail.com wrote:

> Jonathan Lang wrote:
>
>> Instead of
>>
>> multi sub *infix:<~>(ArabicStr $s1, ArabicStr $s2) {...}
>> multi sub *infix:<~>(Str $s1, ArabicStr $s2) {...}
>> multi sub *infix:<~>(ArabicStr $s1, Str $s2) {...}
>
>
> as S13 say
>
> multi sub infix:<+> (Us $us, Them $them) is commutative {
> myadd($us,$them) }

I believe this declares that $a + $b == $b + $a, not just that you can
swap the types of the arguments. I.e. it implements

multi sub infix:<+> (Them $them, Us $us) { $us + $them }

for you. And string concatenation isn't commutative.

Miro


0 new messages