Author: lwall Date: 2010-01-21 18:24:54 +0100 (Thu, 21 Jan 2010) New Revision: 29571
Modified: docs/Perl6/Spec/S03-operators.pod docs/Perl6/Spec/S07-iterators.pod Log: [S03,S07] bring list assignment descriptions into better alignment for pmichaud++ Modified: docs/Perl6/Spec/S03-operators.pod =================================================================== --- docs/Perl6/Spec/S03-operators.pod 2010-01-21 13:34:35 UTC (rev 29570) +++ docs/Perl6/Spec/S03-operators.pod 2010-01-21 17:24:54 UTC (rev 29571) @@ -15,8 +15,8 @@ Created: 8 Mar 2004 - Last Modified: 20 Jan 2010 - Version: 184 + Last Modified: 21 Jan 2010 + Version: 185 =head1 Overview @@ -2004,13 +2004,15 @@ are scalar destinations on the left or already-computed values on the right. However, many list lvalues end with an array destination (where assignment directly to an array can be considered a degenerate -case). When copying into an array destination, the list assignment -continues to copy in known values immediately, but suspends when it -hits an actively iterating iterator (but not one merely passed as an -object within the list). The array location on the left is then set -up as a self-extending array, with the remainder of the list on the -right as the "specs" for its remaining values, to be reified on -demand. Hence it is legal to say: +case). When copying into an array destination, the list assignment is +"mostly eager"; it requests the list to evaluate its leading iterators +(and values) to the extent that they are known to be finite, and +then suspend, returning the known values. The assignment then copies +the known values into the array. (These two steps might actually be +interleaved depending on how the iterator API ends up being defined.) +It then sets up the array to be self-extending by using the remainder +of the list as the "specs" for the array's remaining values, to be +reified on demand. Hence it is legal to say: @natural = 0..*; Modified: docs/Perl6/Spec/S07-iterators.pod =================================================================== --- docs/Perl6/Spec/S07-iterators.pod 2010-01-21 13:34:35 UTC (rev 29570) +++ docs/Perl6/Spec/S07-iterators.pod 2010-01-21 17:24:54 UTC (rev 29571) @@ -14,8 +14,8 @@ Created: 27 Nov 2008 - Last Modified: 20 Apr 2009 - Version: 5 + Last Modified: 21 Jan 2010 + Version: 6 =head1 Laziness and Eagerness @@ -87,6 +87,16 @@ will be eagerly evaluated. +Despite the fact that "mostly eager" treats some iterators as potentially +infinite, a list assignment to multiple targets forces evaluation (by demand) +of enough of the list to fill any scalar destinations before a final "slurpy" +destination. Hence: + + ($a, $b, @c) = 1..*; + +takes the lazy iterator returned by the right side and forces it to divulge +a C<1> and a C<2> before setting up C<@c> to mean C<3..*> lazily. + =item Feed operators: my @a <== @something; The feed operator is strictly lazy, meaning that no operation should