Author: lwall Date: 2009-03-05 20:11:49 +0100 (Thu, 05 Mar 2009) New Revision: 25712
Modified: docs/Perl6/Spec/S12-objects.pod Log: more method declaration clarification, ruoso++ Modified: docs/Perl6/Spec/S12-objects.pod =================================================================== --- docs/Perl6/Spec/S12-objects.pod 2009-03-05 19:00:13 UTC (rev 25711) +++ docs/Perl6/Spec/S12-objects.pod 2009-03-05 19:11:49 UTC (rev 25712) @@ -214,6 +214,20 @@ in fact called with a different syntax that uses C<!> in place of the C<.> character. See below.) +Unlike with most other declarations, C<method> declarations do not +default to C<our> semantics, or even C<my> semantics, but rather +C<has> semantics. So instead of installing a symbol into a lexical +or package symbol table, they merely install a public or private +method in the current class or role via calls to its metaobject. +(Likewise for C<submethod> declarations--see L<Submethods> below.) + +Use of an explicit C<has> declarator has no effect on the declaration. +You may install additional aliases to the method in the lexical scope +using C<my> or in the current package using C<our>. These aliases +are named with C<&foo> notation and return a C<Routine> object that +may be called as a subroutine, in which case you must supply the +expected invocant as the first argument. + To call an ordinary method with ordinary method-dispatch semantics, use either the dot notation or indirect object notation: