r30242 - docs/Perl6/Spec

2010-03-30 Thread pugs-commits
Author: lwall
Date: 2010-03-30 20:22:09 +0200 (Tue, 30 Mar 2010)
New Revision: 30242

Modified:
   docs/Perl6/Spec/S02-bits.pod
   docs/Perl6/Spec/S09-data.pod
Log:
[S02,S09] capitalize Junction again
conjecture a junction-like Each type


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-03-30 18:11:56 UTC (rev 30241)
+++ docs/Perl6/Spec/S02-bits.pod2010-03-30 18:22:09 UTC (rev 30242)
@@ -13,8 +13,8 @@
 
 Created: 10 Aug 2004
 
-Last Modified: 26 Mar 2010
-Version: 209
+Last Modified: 30 Mar 2010
+Version: 210
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -573,11 +573,6 @@
 repeated autoboxing can slow your program more than the native type
 can speed it up.)
 
-The C type is considered a native type because its internal
-representation is fixed, and you may not usefully derive from it
-because the intent of junctions is to autothread any method calls
-on them.
-
 Some object types can behave as value types.  Every object can produce
 a "WHICH" value that uniquely identifies the
 object for hashing and other value-based comparisons.  Normal objects
@@ -1156,7 +1151,7 @@
 automatically declaring a undefined prototype value with the same name, known
 as the I.  The name itself returns that type object:
 
-Mu  Perl 6 object (default block parameter type, either Any or 
junction)
+Mu  Perl 6 object (default block parameter type, Any, Junction, or 
Each)
 Any Perl 6 object (default routine parameter type, excludes 
junction)
 CoolPerl 6 Convenient OO Loopbacks
 WhateverWildcard (like Any, but subject to do-what-I-mean via MMD)
@@ -1173,7 +1168,7 @@
 on the type specified by the container but continues to carry the
 C role.  Use C to return specific failures.  Use C
 for the most generic non-failure undefined value.  The C type,
-derived from C, is also undefined, but excludes C so
+derived from C, is also undefined, but excludes C and C 
types so
 that autothreading may be dispatched using normal multiple dispatch
 rules.  All user-defined classes derive from the C class by default.
 The C type is derived from C but nothing else

Modified: docs/Perl6/Spec/S09-data.pod
===
--- docs/Perl6/Spec/S09-data.pod2010-03-30 18:11:56 UTC (rev 30241)
+++ docs/Perl6/Spec/S09-data.pod2010-03-30 18:22:09 UTC (rev 30242)
@@ -13,8 +13,8 @@
 
 Created: 13 Sep 2004
 
-Last Modified: 4 Mar 2010
-Version: 44
+Last Modified: 30 Mar 2010
+Version: 45
 
 =head1 Overview
 
@@ -944,8 +944,10 @@
 Perl 6's GC approach, as long as PDL's objects are registered with Parrot
 correctly.)
 
-=head1 Junctions
+=head1 Autothreading types
 
+=head2 Junctions
+
 A junction is a superposition of data values pretending to be a single
 data value.  Junctions come in four varieties:
 
@@ -980,9 +982,10 @@
 In particular, if a junction is used as an argument to any routine
 (operator, closure, method, etc.), and the scalar parameter you
 are attempting to bind the argument to is inconsistent with the
-C type, that routine is "autothreaded", meaning the routine
+C type, that routine is "autothreaded", meaning the routine
 will be called automatically as many times as necessary to process
 the individual scalar elements of the junction in parallel.
+(C types are also autothreaded, but are serial and lazy in nature.)
 
 The results of these separate calls are then recombined into a
 single junction of the same species as the junctive argument.
@@ -1054,17 +1057,16 @@
 please limit use of junctions to situations where the eventual binding
 to a scalar formal parameter is clear.
 
-(Conjucture: in post-Perl 6.0.0 we might introduce an C
-junction which keeps track of its initial values, returning on collapse
-those initial values which transformed into a true value, for example
+=head2 Each
 
-each(2, 3, 4) - 3
+[This section is considered conjectural.]
 
-would return an unordered collection consisting of 2 and 4, because
-C<2-3> and C<4-3> are True in boolean context, while C<3-3> is False.
-However it is not yet clear if we really want that, and if yes, in which
-context the collapse will occur).
+An C type autothreads like a junction, but does so serially and lazily,
+and is used only for its mapping capabilities.  The prototypical use
+case is where a hyperoperator would parallelize in an unfortunate way:
 
+@array».say  # order not guaranteed
+@array.each.say  # order guaranteed
 
 =head1 Parallelized parameters and autothreading
 



r30245 - docs/Perl6/Spec

2010-03-30 Thread pugs-commits
Author: lwall
Date: 2010-03-31 02:27:28 +0200 (Wed, 31 Mar 2010)
New Revision: 30245

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] much cleanup of cursor semantics to reflect what STD and Rakudo actually 
do
Retarget <&foo> form to explicitly call routine like <.foo> calls method.
A bare  now prefers a lexical function if visible, or calls as a method if 
not.


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-03-30 21:37:33 UTC (rev 30244)
+++ docs/Perl6/Spec/S05-regex.pod   2010-03-31 00:27:28 UTC (rev 30245)
@@ -16,8 +16,8 @@
 
 Created: 24 Jun 2002
 
-Last Modified: 6 Mar 2010
-Version: 116
+Last Modified: 30 Mar 2010
+Version: 117
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I rather than "regular
@@ -803,10 +803,9 @@
 
 A second call to C overrides any previous call to C.
 
-These closures are invoked with a topic (C<$_>) of the current match
-state (a C object).  Within a closure, the instantaneous
-position within the search is denoted by the C<.pos> method on
-that object.  As with all string positions, you must not treat it
+Within a closure, the instantaneous
+position within the search is denoted by the C<$¢.pos> method.
+As with all string positions, you must not treat it
 as a number unless you are very careful about which units you are
 dealing with.
 
@@ -1142,7 +1141,7 @@
 The first character after the identifier determines the treatment of
 the rest of the text before the closing angle.  The underlying semantics
 is that of a function or method call, so if the first character is
-a left parenthesis, it really is a call:
+a left parenthesis, it really is a call to either a method or function:
 
 
 
@@ -1155,13 +1154,26 @@
 
 $ = 
 
-Note that this aliasing does not modify the original C<<  >> capture.
-To rename a capture entirely, use the dot form on the capture you wish
-to suppress:
+Note that this aliasing does not modify the original C<<  >>
+capture.  To rename an inherited method capture without using the
+original name, use the dot form described below on the capture you
+wish to suppress.  That is,
 
 
+
+desugars to:
+
 $ = <.bar>
 
+Likewise, to rename a lexically scoped regex explicitly, use the C<&>
+form described below.  That is,
+
+
+
+desugars to:
+
+$ = <&bar>
+
 Multiple aliases are allowed, so
 
 
@@ -1196,10 +1208,42 @@
 Longest-token matching does not proceed past such a subrule, for
 instance.
 
+This form always gives preference to a lexically scoped regex declaration,
+dispatching directly to it as if it were function.  If there is no such
+lexical regex (or lexical method) in scope, the call is dispatched to the
+current grammar, assuming there is one. That is, if there is a
+C visible from the current lexical scope, then
+
+
+
+means the same as
+
+
+
+However, if there is no such lexically scoped regex (and note that within
+a grammar, regexes are installed as methods which have no lexical alias
+by default), then the call is dispatched as a normal method on the current
+C (which will fail if you're not currently within a grammar).  So
+in that case:
+
+
+
+means the same as:
+
+
+
+A call to C<<  >> will fail if there is neither any lexically
+scoped routine of that name it can call, nor any method of that name
+that be reached via method dispatch.  (The decision of which dispatcher
+to use is made at compile time, not at run time; the method call is not
+a fallback mechanism.)
+
 =item *
 
-A leading C<.> causes a named assertion not to capture what it matches (see
-L. For example:
+A leading C<.> explicitly calls a method as a subrule; the fact
+that the initial character is not alphanumeric also causes the named
+assertion to not capture what it matches (see L. For
+example:
 
  / /  # $/ and $/ both captured
  / <.ident>   /  # only $/ captured
@@ -1208,24 +1252,64 @@
 The assertion is otherwise parsed identically to an assertion beginning with
 an identifier, provided the next thing after the dot is an identifier.  As with
 the identifier form, any extra arguments pertaining to the matching engine
-are automatically supplied to the argument list.
+are automatically supplied to the argument list via the implicit C 
invocant.
+If there is no current class/grammar, or the current class is not derived
+from C, the call is likely to fail.
 
-If the dot is not followed by an identifier, it
-is parsed as a "dotty" postfix of some type, such as an indirect method call:
+If the dot is not followed by an identifier, it is parsed as a "dotty"
+postfix of some type, such as an indirect method call:
 
-<.$indirect($depth, $binding, $fate, @args)>
+<.$indirect(@args)>
 
-In this case the object passed as the invocant is the current match
-state, and the method is expected to return a new match state object