Author: lwall
Date: 2010-02-01 21:33:47 +0100 (Mon, 01 Feb 2010)
New Revision: 29605
Modified:
docs/Perl6/Spec/S02-bits.pod
docs/Perl6/Spec/S03-operators.pod
docs/Perl6/Spec/S04-control.pod
Log:
[S02,S03,S04] more @@ removal; some s/Capture/Parcel/ cleanup
Modified: docs/Perl6/Spec/S02-bits.pod
===================================================================
--- docs/Perl6/Spec/S02-bits.pod 2010-02-01 20:14:16 UTC (rev 29604)
+++ docs/Perl6/Spec/S02-bits.pod 2010-02-01 20:33:47 UTC (rev 29605)
@@ -1600,7 +1600,6 @@
% unordered hash (associative array)
& code/rule/token/regex
:: package/module/class/role/subset/enum/type/grammar
- @@ slice view of @
Within a declaration, the C<&> sigil also declares the visibility of the
subroutine name without the sigil within the scope of the declaration:
@@ -2124,7 +2123,7 @@
operators:
print $( foo() ) # foo called in item context
- print @@( foo() ) # foo called in slice context
+ print %( foo() ) # foo called in hash context
In declarative constructs bare sigils may be used as placeholders for
anonymous variables:
Modified: docs/Perl6/Spec/S03-operators.pod
===================================================================
--- docs/Perl6/Spec/S03-operators.pod 2010-02-01 20:14:16 UTC (rev 29604)
+++ docs/Perl6/Spec/S03-operators.pod 2010-02-01 20:33:47 UTC (rev 29605)
@@ -15,8 +15,8 @@
Created: 8 Mar 2004
- Last Modified: 30 Jan 2010
- Version: 188
+ Last Modified: 1 Feb 2010
+ Version: 189
=head1 Overview
@@ -205,7 +205,6 @@
%z
$^a
$?FILE
- @@slice
&func
&div:(Int, Int --> Int)
@@ -217,7 +216,6 @@
@()
%()
&()
- @@()
=item *
@@ -919,11 +917,10 @@
@list xx $count
Evaluates the left argument in list context, replicates the resulting
-C<Capture> value the number of times specified by the right argument and
-returns the result in a context dependent fashion. If the operator
-is being evaluated in ordinary list context, the operator returns a
-flattened list. In slice (C<@@>) context, the operator converts each
C<Capture>
-to a separate sublist and returns the list of those sublists.
+C<Parcel> value the number of times specified by the right argument
+and returns the result as a list of C<Parcels> (which will behave
+differently depending on whether it's bound into a flat context or
+a slice context).
If the count is less than 1, returns the empty list, C<()>.
If the count is C<*>, returns an infinite list (lazily, since lists
@@ -1703,11 +1700,11 @@
('a', '1'), ('a', '2'), ('b', '1'), ('b', '2')
-This becomes a flat list in C<@> context and a list of arrays in C<@@> context:
+This becomes a flat list in flat context and a list of arrays in slice context:
- say @(<a b> X <1 2>)
+ say flat(<a b> X <1 2>)
'a', '1', 'a', '2', 'b', '1', 'b', '2'
- say @@(<a b> X <1 2>)
+ say slice(<a b> X <1 2>)
['a', '1'], ['a', '2'], ['b', '1'], ['b', '2']
The operator is list associative, so
@@ -2358,7 +2355,7 @@
The forms with the double angle append rather than clobber the sink's
todo list. The C<<< ==>> >>> form always looks ahead for an appropriate
target to append to, either the final sink in the chain, or the next
-filter stage with an explicit C<@(*)> or C<@@(*)> target. This means
+filter stage with an explicit C<@(*)> or C<@(**)> target. This means
you can stack multiple feeds onto one filter command:
source1() ==>>
@@ -4655,7 +4652,7 @@
turn into subarrays, and each element would then have to be unpacked
by the signature:
- for @@(zip(@names; @codes)) -> [$name, $zip] {
+ for slice(zip(@names; @codes)) -> [$name, $zip] {
print "Name: $name; Zip code: $zip\n";
}
Modified: docs/Perl6/Spec/S04-control.pod
===================================================================
--- docs/Perl6/Spec/S04-control.pod 2010-02-01 20:14:16 UTC (rev 29604)
+++ docs/Perl6/Spec/S04-control.pod 2010-02-01 20:33:47 UTC (rev 29605)
@@ -352,9 +352,9 @@
iteration. Iterations that return a null list (such as by calling
C<next> with no extra return arguments) interpolate no values in the
resulting list. (This list is actually a two-dimensional list of
-C<Capture>s (a "slice") with dimensional boundaries at each iteration.
+C<Parcel>s (a "slice") with dimensional boundaries at each iteration.
Normal list context ignores these boundaries and flattens the list.
-Slice context turns the captures into subarrays, so an iteration
+Slice context turns the parcels into sublists, so an iteration
returning a null list does show up as a null subarray when viewed as
a slice.)
@@ -688,16 +688,18 @@
the statement or block in sink (void) context; its return value is instead
specified by calling the C<take> list prefix operator one or more times
within the dynamic scope of the C<gather>. The C<take> function's
-signature is like that of C<return>; it merely captures the C<Capture>
+signature is like that of C<return>; it merely wraps up a C<Parcel>
of its arguments without imposing any additional constraints (in the
absence of context propagation by the optimizer). The value returned
-by the C<take> to its own context is that same C<Capture> object (which
+by the C<take> to its own context is that same C<Parcel> object (which
is ignored when the C<take> is in sink context). Regardless of the
-C<take>'s context, the C<Capture> object is also added to the list of
+C<take>'s context, the C<Parcel> object is also added to the list of
values being gathered, which is returned by the C<gather> in the form
-of a lazy slice, with each slice element corresponding to one C<take>
-capture. (A list of C<Capture>s is lazily flattened in normal list context,
-but you may "unflatten" it again with a C<@@()> contextualizer.)
+of a lazy list of C<Parcel>s, with each element corresponding to one C<take>
+parcel. (A C<Parcel>s is normally flattened when bound into slurpy context,
+but when bound into a slice context, the C<Parcel> objects become real
+sublists. The eventual binding context thus determines whether to
+throw away or keep the groupings resulting from each individual C<take> call.)
Because C<gather> evaluates its block or statement in sink context,
this typically causes the C<take> function to be evaluated in sink
@@ -714,15 +716,15 @@
The C<take> function essentially has two contexts simultaneously, the
context in which the C<gather> is operating, and the context in which the
C<take> is operating. These need not be identical contexts, since they
-may bind or coerce the resulting captures differently:
+may bind or coerce the resulting parcels differently:
my @y;
- @x = gather for 1..2 { # @() context for list of captures
- my $x = take $_, $_ * 10; # $() context for individual capture
+ @x = gather for 1..2 { # flat context for list of parcels
+ my $x = take $_, $_ * 10; # item context for individual parcel
push @y, $x;
}
# @x contains 4 Ints: 1,10,2,20
- # @y contains 2 Captures: (1,10),(2,20)
+ # @y contains 2 Parcels: (1,10),(2,20)
Likewise, we can just remember the gather's result by binding and
later coerce it:
@@ -730,9 +732,9 @@
$c := gather for 1..2 {
take $_, $_ * 10;
}
- # @$c produces 1,10,2,20 -- flatten fully into a list of Ints.
- # @@$c produces (1,10),(2,20) -- list of Captures, a 2-D list.
- # $$c produces ((1,10),(2,20)) -- the saved Capture itself as one item in
item context.
+ # $c.flat produces 1,10,2,20 -- flatten fully into a list of Ints.
+ # $c.slice produces (1,10),(2,20) -- list of Parcels, a 2-D list.
+ # $c.item produces ((1,10),(2,20)) -- the saved Parcel itself as one item
in item context.
Note that the C<take> itself is in sink context in this example because
the C<for> loop is in sink context.