Author: larry
Date: Tue Apr 24 22:06:33 2007
New Revision: 14382
Modified:
doc/trunk/design/syn/S06.pod
doc/trunk/design/syn/S12.pod
Log:
Clarifications suggested by TheDamian++
Killed "next METHOD", now just use nextsame etc.
Defined "lastcall" to allow return from final candidate.
Set up WHENCE mechanism for undefined prototype objects to autovivify lazily.
Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podTue Apr 24 22:06:33 2007
@@ -2100,7 +2100,15 @@
C and C, but a tail call is explicitly enforced;
any code following the call will be unreached, as if a return had
been executed there before calling into the destination routine.
-Within a method C is equivalent to C.
+
+Within an ordinary method dispatch these functions treat the rest
+of the dispatcher's candidate list as the wrapped function, which
+generally works out to calling the same method in one of our parent
+(or older sibling) classes. Likewise within a multiple dispatch the
+current routine may defer to candidates further down the candidate
+list. Although not necessarily related by a class hierarchy, such
+later candidates are considered more generic and hence likelier
+to be able to handle various unforeseen conditions (perhaps).
=head2 The C<&?ROUTINE> object
Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podTue Apr 24 22:06:33 2007
@@ -12,9 +12,9 @@
Maintainer: Larry Wall <[EMAIL PROTECTED]>
Date: 27 Oct 2004
- Last Modified: 13 Apr 2007
+ Last Modified: 24 Apr 2007
Number: 12
- Version: 46
+ Version: 47
=head1 Overview
@@ -199,14 +199,14 @@
Indirect object notation now requires a colon after the invocant,
even if there are no arguments after the colon:
-$handle.close
-close $handle:
+$handle.close;
+close $handle:;
To reject method call and only consider subs, simply omit the colon
from the invocation line:
-close($handle)
-close $handle
+close($handle);
+close $handle;
However, here the built-in B class defines C,
which puts a C in scope by default. Thus if the
@@ -233,7 +233,7 @@
.'+' # same as +$_
And in fact, if there is a choice between a unary prefix and a postfix
-operator, the indirect forms will choose the prefix operator. See S03.
+operator, the quoted forms will choose the prefix operator. See S03.
Likewise, presuming that C<$op> does not name an ordinary method on
C<$left>, this calls any arbitrary infix operator:
@@ -392,8 +392,10 @@
visible to derived classes via inheritance. A submethod is called
only when a method call is dispatched directly to the current class.
-[Conjecture: there is some relationship between "submethod BUILD" and
-"method ^BUILD" that possibly rises to the level of a unifiable identity...]
+Conjecture: in order to catch spelling errors it is a compile-time
+warning to define a submethod in any class that does not inherit the
+corresponding method name from some base class. (But note that the
+standard C class supplies a default C and C.)
=head1 Attributes
@@ -564,7 +566,7 @@
The default C and C are inherited from C, so
you need to write initialization routines only if you wish to modify
the default behavior. If the name of a named argument begins with a
-C<::> and corresponds to a class or role being built, the list value
+C<::> and corresponds to a (super)class or role being built, the list value
of that argument is passed as a list of named arguments to that class
or role's C. (If the value of that argument is a closure
instead of a list, that closure will be called to return a list.
@@ -572,6 +574,9 @@
being initialized.) In the absence of a class-labeled pair, all
the arguments to C are passed to the C.
+class Dog is Animal {...}
+my $pet = Dog.new( :name, Animal => [:blood :legs(4)] );
+
You can clone an object, changing some of the attributes:
$newdog = $olddog.clone(:trick);
@@ -661,9 +666,7 @@
$object."+meth"(@args)
$object.'VAR'(@args)
-Any method can defer to the next candidate method in the list by
-saying C. Any method can stop the progression by saying
-C. The order and selection of the candidates may be
+The order and selection of the candidates may be
specified by arguments to a pseudo-class known as C:
$object.*WALK[:breadth:omit($?CLASS)]::meth(@args);
@@ -681,10 +684,15 @@
:omit(Selector) # only classes that don't match selector
:include(Selector) # only classes that match selector
-In addition to C, the special functions C,
-C, C, and C dispatch to the next
-candidate, possibly with a new argument list, and if the "next"
-variant is used, without returning:
+Any method can defer