Thomas Wittek <[EMAIL PROTECTED]> writes:
> Steffen Schwigon schrieb:
>> At least the many keywords seem to be necessary to map the complexity
>> of different paradigms possible in Perl6. Multimethods are not just
>> overloading as in C++. Second, the different keywords declare
>> different behaviour you can choose. Just read S06, it's explained
>> quite understandable.
> Hm, but wouldn't whose be equivalent?
>   sub foo ($bar) {
>     $bar.say;
>   }
>   multi sub foo ($bar) {
>     $bar.say;
>   }
> Aren't subs a subset of multi subs, meaning that every sub can be
> expressed as a multi sub?
> Is there anything a sub has in advantage of a multi sub?
> So might not just every sub be a multi sub?
> If the only difference is, that you _must not_ declare a sub twice with
> different argument lists, I think that this one is relatively
> unimportant and letting every sub be a multi sub seems to be more
> consistent to me in opposite to this arbitrary looking distinction.
> Maybe I just phenomenally misunderstood multi subs, but unless I
> did, I can't see why we want to have subs when we can have multi
> subs that can do the same and even more.

I understand your point and I confess I'm not sure.

At least there seems to be a visibility difference. In S12 I found
those two sentences:

1. [sub (or method) without a multi] [...] Only one such sub (or
   method) can inhabit a given namespace, and it hides any outer subs
   (or less-derived methods) of the same short name.

2. [subs or methods declared multi] [...] It does not hide any
   routines with the same short name but a different long name. In
   other words, multis with the same short name can come from several
   different namespaces provided their long names differ and their
   short names aren't hidden by a non-multi declaration in some
   intermediate scope.

Steffen Schwigon <[EMAIL PROTECTED]>
Dresden Perl Mongers <>

Reply via email to