Author: autrijus Date: Sat Apr 1 20:49:18 2006 New Revision: 8534 Modified: doc/trunk/design/syn/S06.pod doc/trunk/design/syn/S12.pod
Log: * Larry (aka TimToady in the previous commit log; sorry for spilling of IRC context) requested that "multi" should still only default to "multi sub" to reduce lookarounds. * Clarify that unary operators such as !$x always prefers method dispatch first, as $x.prefix<!>. Modified: doc/trunk/design/syn/S06.pod ============================================================================== --- doc/trunk/design/syn/S06.pod (original) +++ doc/trunk/design/syn/S06.pod Sat Apr 1 20:49:18 2006 @@ -62,15 +62,7 @@ proto method bar {...} multi method bar {...} -If the routine keyword is omitted, it defaults to C<method> inside a -class or role, and C<sub> inside a module or package. - - class C { - multi foo {...} # multi method foo - } - module M { - multi bar {...} # multi sub bar - } +If the routine keyword is omitted, it defaults to C<sub>. =head2 Named subroutines @@ -467,7 +459,7 @@ If the parameter list for a C<multi> contains no colon to delimit the list of invocant parameters, then all positional parameters are considered invocants. If it's a C<multi method> and C<multi submethod>, -an additional implicit unamed C<self> invocant is prepended to the +an additional implicit unnamed C<self> invocant is prepended to the signature list. For the purpose of matching positional arguments against invocant parameters, Modified: doc/trunk/design/syn/S12.pod ============================================================================== --- doc/trunk/design/syn/S12.pod (original) +++ doc/trunk/design/syn/S12.pod Sat Apr 1 20:49:18 2006 @@ -651,6 +651,10 @@ close($handle,) +This applies to prefix unary operators as well: + + !$obj; # same as $obj.prefix:<!> + A method call first considers methods (including multi-methods and submethods) from the class hierarchy of C<$handle>, and fails over to the subroutine dispatcher as a last resort only if no method can be found in the class @@ -686,9 +690,7 @@ The syntax for calling back to C<MyClass> is C<$obj!MyClass::meth()>. -Outside a class or a role, the C<sub> keyword is optional after either -C<multi> or C<proto>. Within a class or a role, the C<method> keyword -is implied instead of C<sub>. +The C<sub> keyword is optional after either C<multi> or C<proto>. A C<proto> declaration must come before any matching multis, if at all.