r29630 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-03 03:28:19 +0100 (Wed, 03 Feb 2010)
New Revision: 29630

Modified:
   docs/Perl6/Spec/S07-iterators.pod
Log:
[S07] typos from markjreed++


Modified: docs/Perl6/Spec/S07-iterators.pod
===
--- docs/Perl6/Spec/S07-iterators.pod   2010-02-03 02:19:04 UTC (rev 29629)
+++ docs/Perl6/Spec/S07-iterators.pod   2010-02-03 02:28:19 UTC (rev 29630)
@@ -184,11 +184,11 @@
 
 =head2 method get {...}
 
-Used to iterator over a flat list (the context supplied by a slurpy binding).
+Used to iterate over a flat list (the context supplied by a slurpy binding).
 Returns the next element from the iterator after flattening any leading parcel.
 
-When it runs out of elements, it will fail with the C exception.
-As with most failures, it is generally returned without throwing it,
+When the iterator runs out of elements, it will fail with the C 
exception.
+As with most failures, C is generally returned without throwing it,
 unless the calling lexical scope requests it to be thrown via "use fatal".
 No list should ever contain the C exception, since iterational
 control flow should always terminate when that value is returned.



r29629 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-03 03:19:04 +0100 (Wed, 03 Feb 2010)
New Revision: 29629

Modified:
   docs/Perl6/Spec/S09-data.pod
Log:
[S09] @@, what's that?  Never heard of it...


Modified: docs/Perl6/Spec/S09-data.pod
===
--- docs/Perl6/Spec/S09-data.pod2010-02-03 02:09:06 UTC (rev 29628)
+++ docs/Perl6/Spec/S09-data.pod2010-02-03 02:19:04 UTC (rev 29629)
@@ -13,8 +13,8 @@
 
 Created: 13 Sep 2004
 
-Last Modified: 8 Jan 2010
-Version: 37
+Last Modified: 2 Feb 2010
+Version: 38
 
 =head1 Overview
 
@@ -25,9 +25,12 @@
 
 =head1 Lazy lists
 
-All list contexts are lazy by default.  They still flatten eventually,
-but only when forced to.  You have to use the C list operator to get a
-non-lazy flattening list context (that is, to flatten immediately like Perl 5).
+All list contexts are lazy by default.  They might still flatten
+eventually, but only when forced to.  You have to use the C
+list operator to get a non-lazy list context, and you have to use the
+C operator to guarantee flattening.  However, such context is
+generally provided by the eventual destination anyway, so you don't
+usually need to be explicit.
 
 =head1 Sized types
 
@@ -208,7 +211,7 @@
 
 @dwarves[7] = 'Sneaky';   # Fails with "invalid index" exception
 
-However, it is legal for a C object to extend beyond the end
+However, it is legal for a range or series iterator to extend beyond the end
 of an array as long as its min value is a valid subscript; the range
 is truncated as necessary to map only valid locations.
 
@@ -217,7 +220,7 @@
 my @vices[*]; # Length is: "whatever"
   # Valid indices are 0..*
 
-For subscripts containing ranges extending beyond the end of
+For subscripts containing range or series iterators extending beyond the end of
 autoextending arrays, the range is truncated to the actual current
 size of the array rather than the declared size of that dimension.
 It is allowed for such a range to start one after the end, so that
@@ -230,19 +233,17 @@
 
 would fail because the range's min is too big.
 
-Going the other way, it is allowed for a range to start with a negative
-number as long as the endpoint is at least -1; in this case the
-front of the range is truncated.
-
 Note that these rules mean it doesn't matter whether you say
 
 @array[*]
 @array[0 .. *]
 @array[0 .. *-1]
-@array[-Inf .. *-1]
 
 because they all end up meaning the same thing.
 
+There is no autotruncation on the left end.  It's not that
+hard to write C<0>, and standard indexes always start there.
+
 As a special form, numeric subscripts may be declared as cyclical
 using an initial C<%>:
 
@@ -294,7 +295,8 @@
 hard to make these elements look like objects when you treat them
 like objects--this is called autoboxing.)
 
-Such arrays are autoextending just like ordinary Perl arrays
+Unless explicitly declared to be of fixed size, such
+arrays are autoextending just like ordinary Perl arrays
 (at the price of occasionally copying the block of data to another
 memory location, or using a tree structure).
 
@@ -314,7 +316,7 @@
 
 and given C<$buffer> you can also say
 
-@pieces = $buffer[$n..^$end];
+@pieces = $buffer[$n ..^ $end];
 
 Note that subscripting still pulls the elements out as numbers,
 but C returns a buffer of the same type.
@@ -355,30 +357,33 @@
 
 You can pass a slice (of any dimensionality) for the shape as well:
 
-@@shape = (4;2);
-my int @ints[ [;]...@shape ];
-my int @ints[@@shape];  # Same thing
+@shape = 4, 2;
+my int @ints[ **(@shape) ];
 
-Again, the C<[;]> list operator interpolates a list into a semicolon
-list.
+The **() form interpolates a list into a semicolon list.
 
-The shape may be supplied entirely by the object at run-time:
+The shape in the declaration merely specifies how the array will
+autovivify on first use, but ends up as an attribute of the actual
+container object thereby.  On the other hand, the shape may be also
+supplied entirely by an explicit constructor at run-time:
 
 my num @nums = Array of num.new(:shape(3;3;3));
 my num @nums .=new():shape(3;3;3); # same thing
 
 A multidimensional array is indexed by a semicolon list, which is really
-a list of feeds in disguise. Each sublist is a slice/feed of one
+a list of lists in disguise. Each sublist is a slice of one
 particular dimension. So:
 
 @array[0..10; 42; @x]
 
-is really short for:
+is really short for something like:
 
-@array.postcircumfix:<[ ]>( <== 0..10 <== 42 <== @x );
+@array.postcircumfix:<[ ]>( (0..10), (42), (@x) );
 
-The compiler is free to optimize to something faster when it is known
-that lazy multidimensional subscripts are not necessary.
+The method's internal C<*...@slices> parameter turns the subscripts into three 
independent
+C lists, which can be read lazily independently of one other.  (Though
+a subscripter w

r29628 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: diakopter
Date: 2010-02-03 03:09:06 +0100 (Wed, 03 Feb 2010)
New Revision: 29628

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29] syntaxos (grammaros?) (spellos?) (typos?)

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2010-02-03 01:32:19 UTC (rev 29627)
+++ docs/Perl6/Spec/S29-functions.pod   2010-02-03 02:09:06 UTC (rev 29628)
@@ -76,7 +76,7 @@
 
 The root class of all "character" types, regardless of level.
 
-This is a subtype of C, limited to a length of 1 at it's highest
+This is a subtype of C, limited to a length of 1 at its highest
 supported Unicode level.
 
 The type name C is aliased to the maximum supported Unicode level
@@ -338,7 +338,7 @@
 
  our List multi flat ( *...@list )
 
-Forces flat context on it's arguments, and returns them.
+Forces flat context on its arguments, and returns them.
 The heavy work is done by the C<*@> binding.
 
 =item list
@@ -352,7 +352,7 @@
 
  our List multi flat ( *...@list )
 
-Forces flat context on it's arguments, and returns them.
+Forces flat context on its arguments, and returns them.
 The heavy work is done by the C<*@> binding.
 
 =item slice



r29627 - docs/Perl6/Spec/S32-setting-library

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-03 02:32:19 +0100 (Wed, 03 Feb 2010)
New Revision: 29627

Modified:
   docs/Perl6/Spec/S32-setting-library/Containers.pod
Log:
[S32/Containers] last @@ removal not counting S09


Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod
===
--- docs/Perl6/Spec/S32-setting-library/Containers.pod  2010-02-03 01:28:18 UTC 
(rev 29626)
+++ docs/Perl6/Spec/S32-setting-library/Containers.pod  2010-02-03 01:32:19 UTC 
(rev 29627)
@@ -19,8 +19,8 @@
 
 Created: 19 Feb 2009 extracted from S29-functions.pod
 
-Last Modified: 21 Jan 2010
-Version: 14
+Last Modified: 2 Feb 2010
+Version: 15
 
 The document is a draft.
 
@@ -50,7 +50,7 @@
 
 =item cat
 
- our Cat multi cat( *@@list )
+ our Cat multi cat( *...@list )
 
 C reads arrays serially rather than in parallel as C does. It
 returns all of the elements of the containers that were passed to it
@@ -67,7 +67,7 @@
 
 =item roundrobin
 
- our Parcel multi roundrobin( *@@list )
+ our Parcel multi roundrobin( *...@list )
 
 C is very similar to C.  The difference is that
 C will not stop on lists that run out of elements but
@@ -82,8 +82,8 @@
 
 =item zip
 
- our Parcel of Parcel multi zip ( *@@list )
- our Parcel of Parcel multi infix: ( *@@list )
+ our Parcel of Parcel multi zip ( *...@list )
+ our Parcel of Parcel multi infix: ( *...@list )
 
 zip takes any number of arrays and returns one tuple for every index.
 This is easier to read in an example:
@@ -108,7 +108,7 @@
 
  for @a Z @b Z @c -> $a, $b, $c {...}
 
-In C<@@> context an Array of Array is returned instead of flat list.
+In slice context a list of C is returned instead of a flat list.
 
 =back
 



r29626 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-03 02:28:18 +0100 (Wed, 03 Feb 2010)
New Revision: 29626

Modified:
   docs/Perl6/Spec/S13-overloading.pod
Log:
[S13] *@@ ---> **@


Modified: docs/Perl6/Spec/S13-overloading.pod
===
--- docs/Perl6/Spec/S13-overloading.pod 2010-02-03 01:25:51 UTC (rev 29625)
+++ docs/Perl6/Spec/S13-overloading.pod 2010-02-03 01:28:18 UTC (rev 29626)
@@ -13,8 +13,8 @@
 
 Created: 2 Nov 2004
 
-Last Modified: 27 Dec 2008
-Version: 12
+Last Modified: 2 Feb 2010
+Version: 13
 
 =head1 Overview
 
@@ -160,14 +160,14 @@
 routine, array, or hash.  The long forms are as follows:
 
 method postcircumfix:<( )> ($capture) {...}
-method postcircumfix:<[ ]> (*@@slice) {...}
-method postcircumfix:<{ }> (*@@slice) {...}
+method postcircumfix:<[ ]> (*...@slice) {...}
+method postcircumfix:<{ }> (*...@slice) {...}
 
 Those are a bit unwieldy, so you may also use these short forms:
 
 method &.( $capture ) {...}
-method @.[ *@@slice ] {...}
-method %.{ *@@slice } {...}
+method @.[ *...@slice ] {...}
+method %.{ *...@slice } {...}
 
 The sigil-dot sequence in these short forms autogenerates the
 corresponding public operators, in exactly the same way that



r29625 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-03 02:25:51 +0100 (Wed, 03 Feb 2010)
New Revision: 29625

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29] more @@ and iterator patchups


Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2010-02-03 01:09:04 UTC (rev 29624)
+++ docs/Perl6/Spec/S29-functions.pod   2010-02-03 01:25:51 UTC (rev 29625)
@@ -20,8 +20,8 @@
 
 Created: 12 Mar 2005
 
-Last Modified: 19 Nov 2009
-Version: 44
+Last Modified: 2 Feb 2010
+Version: 45
 
 The document is a draft.
 
@@ -334,21 +334,35 @@
 
 Forces generic Item context on its argument, and returns it.
 
+=item flat
+
+ our List multi flat ( *...@list )
+
+Forces flat context on it's arguments, and returns them.
+The heavy work is done by the C<*@> binding.
+
 =item list
 
- our List multi list ( *...@list )
+ our List multi list ( Iterable $item ) { $item.iterator.list }
+ our List multi list ( List \$iter ) { $iter }
 
-Forces List Context on it's arguments, and returns them.
+Almost a no-op; just makes sure that $item can be iterated.
 
+=item flat
+
+ our List multi flat ( *...@list )
+
+Forces flat context on it's arguments, and returns them.
+The heavy work is done by the C<*@> binding.
+
 =item slice
 
- our List multi slice ( *...@list )
+ our List multi slice ( *...@list )
 
 Forces the argument list to be evaluated in slice context.
 (Slices are considered to be potentially multidimensional in Perl 6.)
-A list of Cs will be transformed into a list of lists.
-Equivalent to C<@@()> (except that empty C<@@()> means C<@@($/)>, while
-empty C means a null slice).
+Any C within the list will be transformed into a C.
+The work is actually done by the binding to the C<**@> parameter.
 
 =item hash
 



r29624 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-03 02:09:04 +0100 (Wed, 03 Feb 2010)
New Revision: 29624

Modified:
   docs/Perl6/Spec/S07-iterators.pod
Log:
[S07] @@ squashing


Modified: docs/Perl6/Spec/S07-iterators.pod
===
--- docs/Perl6/Spec/S07-iterators.pod   2010-02-03 00:47:37 UTC (rev 29623)
+++ docs/Perl6/Spec/S07-iterators.pod   2010-02-03 01:09:04 UTC (rev 29624)
@@ -222,6 +222,10 @@
 No list should ever contain the C exception, since iterational
 control flow should always terminate when that value is returned.
 
+Note: C and C must be atomic for any iterator shared
+by more than one thread, since it is likely that message passing is
+implemented in terms of them.
+
 =head2 method batchobj ($max?) {...}
 
 Returns a batch of parcels/objects in some appropriate C type that
@@ -379,25 +383,34 @@
 
 =head2 Generic Lazy Slice
 
-The generic lazy slice consumes the Cs from an iterator but
+The generic lazy slice consumes the Cs from an iterator but
 stores the results as a bi-dimensional list, where the first dimension
 corresponds to an iteration, and the second contains the values in
 the C returned for that iteration, but turned into a C object.
 Empty C objects are turned into empty C objects.
+Any other object is returned as itself.
 
-To obtain a generic lazy slice, end a feed in a sliced C.
+To obtain a generic lazy slice, end a feed in a sliced binding.
 
-my @@it <== map { ... }, 1,2,3;
+my *...@it <== map { ... }, 1,2,3;
 
-(XXX TODO:
+Note that in:
 
-@@it <== (1,mysub(),2;1,2,3);
-@@it[0];
-@@it[0;1];
+my *...@it <== (1,mysub(),2; 1..*);
 
- exactly when does mysub() get called?)
+the slice lists are independently lazy.  However, the call to
+C is not particularly lazy; it occurs when the parcel is
+constructed.  Any laziness is in the function's return value, not in
+the call.  A call in the top level of any parcel is called eagerly.
+To call a function lazily it is necessary to embed the call in some
+other explicitly lazy operator:
 
+1, (() ... { START mysub() }), 2  # harder way
+1, lazy { mysub() }, 2# easier way
 
+[Note: the above text really belongs somewhere else, but I'm too lazy to
+figure out where.]
+
 =head1 Coroutines
 
 Perl6 does not have a formally defined sub-style coroutine.  Doubtless



Re: One-pass parsing and forward type references

2010-02-02 Thread Larry Wall
On Mon, Feb 01, 2010 at 06:12:16PM -0800, Jon Lang wrote:
: Larry Wall wrote:
: > But also note that there are several other ways to predeclare
: > types implicitly.  The 'use', 'require', and 'need' declarations
: > all introduce a module name that is assumed to be a type name.
: 
: Just to clarify: it's possible to define a module within a file,
: rather than as a file; and in fact the usual means of defining classes
: and roles is an example of this, since they are specialized kinds of
: modules.  Correct?  So if I' understanding this correctly, you should
: be able to say something like:
: 
: use Foo;
: class Bar { ... has Foo $x ... }
: class Foo { ... }
: 
: ...where the dots are stand-ins for irrelevant code.  In effect, "use"
: tells the compiler that Foo is a noun, so that the parser knows the
: proper way to handle it.  It also looks for the definition of Foo; but
: will it start screaming bloody murder if it can't find the definition
: right away?  Have I failed to correctly tell it where to look for the
: definition?  (i.e., do I need to say something like "use ::Foo" to let
: the parser know that the definition is in this file?)

You should use 'class Foo {...}' for a forward declaration of a class
in the same file, not a vacuous 'use' that implies strongly but wrongly
that the definitions are in another file.  To look at it another way,
'use' is a real predeclaration, not a pre-non-declaration such as we
mean when we talk about "forward" declarations.

In other words, the above should really be giving you an illegal
redeclaration of class Foo, if Foo.pm did as advertised and created
a Foo type.  You'd have to use 'augment' to do monkey typing like that.

There has been some speculation that we could allow proto and multi
classes when the intent is to scatter the definition around.  But that
hasn't yet been determined to be a Good Thing.  The compiler would like
to know that it can compose a class when it sees the trailing curly,
in case someone wants to use it in a subsequent BEGIN.  Allowing multi
classes would necessarily subvert that at least till CHECK time, if
not till first use.  You'd generally like to catch method name conflicts
no later than CHECK time.

Larry


Re: Parrot and Perl 6 Summary

2010-02-02 Thread Lithos
Please find:

http://lith-ology.blogspot.com/2010/02/seven-days-between-parrot-and-camel.html

Lithos


r29622 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-02 21:24:34 +0100 (Tue, 02 Feb 2010)
New Revision: 29622

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] more @@ clobberation.
also remove * as a feed target, just use a variable.
conjecture a **() special form for interpolating into slice lists


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-02-02 18:21:24 UTC (rev 29621)
+++ docs/Perl6/Spec/S06-routines.pod2010-02-02 20:24:34 UTC (rev 29622)
@@ -16,8 +16,8 @@
 
 Created: 21 Mar 2003
 
-Last Modified: 1 Feb 2010
-Version: 126
+Last Modified: 2 Feb 2010
+Version: 127
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -983,9 +983,9 @@
 that they wish not to be flattened into one list.  For instance, C wants
 to iterate several lists in parallel, while array and hash subscripts want to
 process a multidimensional slice.  The set of underlying argument lists may be
-bound to a single array parameter declared with a double C<@@> sigil:
+bound to a single array parameter declared with a double C<**> marker:
 
-sub foo (*@@slice) { ... }
+sub foo (*...@slice) { ... }
 
 Note that this is different from
 
@@ -993,7 +993,7 @@
 
 insofar as C<|$slice> is bound to a single argument-list object that
 makes no commitment to processing its structure (and maybe doesn't
-even know its own structure yet), while C<*@@slice> has to create
+even know its own structure yet), while C<*...@slice> has to create
 an array that binds the incoming dimensional lists to the array's
 dimensions, and make that commitment visible to the rest of the scope
 via the sigil so that constructs expecting multidimensional lists
@@ -1001,16 +1001,16 @@
 
 It is allowed to specify a return type:
 
-sub foo (*@@slice --> Num) { ... }
+sub foo (*...@slice --> Num) { ... }
 
 The invocant does not participate in multi-dimensional argument lists,
-so C is not present in the C<@@slice> below:
+so C is not present in the C<*...@slice> below:
 
-method foo (*@@slice) { ... }
+method foo (*...@slice) { ... }
 
-The C<@@> sigil is just a variant of the C<@> sigil, so C<@@slice>
-and C<@slice> are really the same array.  In particular, C<@@_> is
-really the good old C<@_> array viewed as multidimensional.
+The C<**> marker is just a variant of the C<*> marker that ends up
+requesting parcels when binding (underlyingly calling .getobj) rather
+than requesting individual elements as the flatening C<*> does.
 
 =head2 Zero-dimensional argument list
 
@@ -1018,9 +1018,9 @@
 argument list becomes a zero-dimensional slice.  It differs from
 C<\()> in several ways:
 
-sub foo (*@@slice) {...}
-foo;# +@@slice == 0
-foo();  # +@@slice == 1
+sub foo (*...@slice) {...}
+foo;# +...@slice == 0
+foo();  # +...@slice == 1
 
 sub bar (|$args = \(1,2,3)) {...}
 bar;# $args === \(1,2,3)
@@ -1137,7 +1137,7 @@
 feed without the use of a temporary array:
 
 foo() ==> say @(*), " is what I meant";
-bar() ==> @@(*).baz();
+bar() ==> @(*).baz();
 
 Likewise, an C used as a tap may be distinguished from an C used
 as a translation function:
@@ -1145,16 +1145,19 @@
 numbers() ==> @array ==> bar()  # tap
 numbers() ==> @array[@(*)] ==> bar()# translation
 
-Feeding into the C<*> "whatever" term sets the source for the next sink.
 To append multiple sources to the next sink, double the angle:
 
-0..*   ==>  *;
-'a'..* ==>> *;
-pidigits() ==>> *;
+my $sink;
+0..*   ==>  $sink;
+'a'..* ==>> $sink;
+pidigits() ==>> $sink;
 
 # outputs "(0, 'a', 3)\n"...
-for zip(@@(*)) { .perl.say }
+for $sink.zip { .perl.say }
 
+Each such append adds another slice element (that is, a parcel), to
+the sink.  (The original feed also created a parcel.)
+
 You may use a variable (or variable declaration) as a receiver, in
 which case the list value is bound as the "todo" of the variable.
 (The append form binds addition todos to the receiver's todo list.)
@@ -1163,7 +1166,9 @@
 that variable contains the newly created iterator itself.  In the case
 of an array, the new iterator is installed as the method for extending
 the array.  As with assignment, the old todo list is clobbered; use the
-append form to avoid that and get push semantics.
+append form to avoid that and get push semantics.  In any case, feeding
+an array always flattens.  You must use the scalar form to preserve
+slice information.
 
 In general you can simply think of a receiver array as representing
 the results of the chain, so you can equivalently write any of:
@@ -1199,15 +1204,15 @@
 is a list of 6 elements.  This is the default behavior.  However,
 sometimes you want to capture the outputs as a list of two iterators,
 namely the two iterators that represent the two input feeds.  You can
-get at t

r29621 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-02 19:21:24 +0100 (Tue, 02 Feb 2010)
New Revision: 29621

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] forgot to change date


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-02-02 18:20:08 UTC (rev 29620)
+++ docs/Perl6/Spec/S05-regex.pod   2010-02-02 18:21:24 UTC (rev 29621)
@@ -16,8 +16,8 @@
 
 Created: 24 Jun 2002
 
-Last Modified: 6 Dec 2009
-Version: 114
+Last Modified: 2 Feb 2010
+Version: 115
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I rather than "regular



r29620 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-02 19:20:08 +0100 (Tue, 02 Feb 2010)
New Revision: 29620

Modified:
   docs/Perl6/Spec/S05-regex.pod
   docs/Perl6/Spec/S07-iterators.pod
Log:
[S05] more @@ whackage
[S07] define flat and slice methods in terms of get and getobj


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-02-02 18:15:55 UTC (rev 29619)
+++ docs/Perl6/Spec/S05-regex.pod   2010-02-02 18:20:08 UTC (rev 29620)
@@ -453,7 +453,7 @@
  $str = "abracadabra";
 
  if $str ~~ m:overlap/ a (.*) a / {
- @substrings = @@();# bracadabr cadabr dabr br
+ @substrings = slice @();# bracadabr cadabr dabr br
  }
 
 =item *
@@ -1056,11 +1056,11 @@
 
 When you get tired of writing:
 
-token sigil { '$' | '@' | '@@' | '%' | '&' | '::' }
+token sigil { '$' | '@' | '%' | '&' | '::' }
 
 you can write:
 
-token sigil { < $ @ @@ % & :: > }
+token sigil { < $ @ % & :: > }
 
 as long as you're careful to put a space after the initial angle so that
 it won't be interpreted as a subrule.  With the space it is parsed
@@ -1076,7 +1076,6 @@
 proto token sigil { }
 multi token sigil:sym<$>  {  }
 multi token sigil:sym<@>  {  }
-multi token sigil:sym<@@> {  }
 multi token sigil:sym<%>  {  }
 multi token sigil:sym<&>  {  }
 multi token sigil:sym<::> {  }
@@ -3633,10 +3632,9 @@
 
 Subcaptures are returned as a multidimensional list, which the user can
 choose to process in either of two ways.  If you refer to
-C<@()>, the multidimensionality is ignored and all the matches are returned
-flattened (but still lazily).  If you refer to C<@@()>, you can
-get each individual sublist as a C object. (That is, there is a 
C<@@()>
-coercion operator that happens, like C<@()>, to default to C<$/>.)
+C<@().flat> (or just use C<@()> in a flat list context), the 
multidimensionality is ignored and all the matches are returned
+flattened (but still lazily).  If you refer to C<@().slice>, you can
+get each individual sublist as a C object.
 As with any multidimensional list, each sublist can be lazy separately.
 
 =back
@@ -3651,9 +3649,9 @@
 match is also available:
 
  if $text ~~ mm:g/ (\S+:)  / {
- say "Matched { +@@() } times";# Note: forced eager here
+ say "Matched { +@().slice } times";# Note: forced eager here by +
 
- for @@() -> $m {
+ for @().slice -> $m {
  say "Match between $m.from() and $m.to()";
  say 'Right on, dude!' if $m[0] eq 'Perl';
  say "Rocks like $m";

Modified: docs/Perl6/Spec/S07-iterators.pod
===
--- docs/Perl6/Spec/S07-iterators.pod   2010-02-02 18:15:55 UTC (rev 29619)
+++ docs/Perl6/Spec/S07-iterators.pod   2010-02-02 18:20:08 UTC (rev 29620)
@@ -231,6 +231,21 @@
 to facilitate numeric end testing if that is desired.  If C<$max> is
 not supplied, the iterator may choose a suitable batch size.
 
+=head2 method flat {...}
+
+This returns an iterator that always flattens by calling C<.get> internally
+(which discards any parcel structure, returning only the parcel's elements).
+The returned iterator will always return the same value regardless of
+whether you call C<.get> or C<.getobj>.
+
+=head2 method slice {...}
+
+This returns an iterator that always anti-flattens by calling C<.getobj> 
internally,
+then hiding any resulting parcel by turning it into a C before returning 
it externally.
+A list of C is thereby transformed into a list of C.
+The returned iterator will always return the same value regardless of
+whether you call C<.get> or C<.getobj>.
+
 =head1 The List::PushBack Role
 
 This role defines an iterator that knows how to receive values back to



Re: r29618 - docs/Perl6/Spec

2010-02-02 Thread Mark J. Reed
On Tue, Feb 2, 2010 at 12:51 PM,   wrote:

>  The methods in this role are:
>
>  =head2 method get {...}
>
> -Returns the next item for that iteration. The grouping of elements
> -returned in each iteration is visible if this iterator is being used
> -to build a slice. While building a list, the items will be flattened.
> +Used to iterator over a flat list (the context supplied by a slurpy binding).

^^^ typo; should be "Used to iterate."


> +Returns the next element from the iterator after flattening any leading 
> parcel.
>
> -When it runs out of items, it will fail with the C exception.
> +When it runs out of elements, it will fail with the C exception.
>  As with most failures, it is generally returned without throwing it,
>  unless the calling lexical scope requests it to be thrown via "use fatal".

A few too many "it"s with different antecedents there.  Might want to
toss in a noun or two.


-- 
Mark J. Reed 


r29618 - docs/Perl6/Spec

2010-02-02 Thread pugs-commits
Author: lwall
Date: 2010-02-02 18:51:25 +0100 (Tue, 02 Feb 2010)
New Revision: 29618

Modified:
   docs/Perl6/Spec/S07-iterators.pod
Log:
[S07] pick slightly less misleading names for iteration primitives
stop using "item" to mean contradictory things
remove confusing discussion of outer flat/slice context; these methods don't
care because that's why there are different method names for get vs getobj


Modified: docs/Perl6/Spec/S07-iterators.pod
===
--- docs/Perl6/Spec/S07-iterators.pod   2010-02-02 17:32:50 UTC (rev 29617)
+++ docs/Perl6/Spec/S07-iterators.pod   2010-02-02 17:51:25 UTC (rev 29618)
@@ -14,8 +14,8 @@
 
 Created: 27 Nov 2008
 
-Last Modified: 29 Jan 2010
-Version: 9
+Last Modified: 2 Feb 2010
+Version: 10
 
 =head1 Laziness and Eagerness
 
@@ -180,62 +180,57 @@
 itself; Perl does not distinguish the two concepts.  Any type
 that supports the C role is an iterator.
 
-This is a minimal API that should allow custom iterator
-implementations, but this spec should be expanded in the future to
-provide additional API for batch-aware iterators.
-
 The methods in this role are:
 
 =head2 method get {...}
 
-Returns the next item for that iteration. The grouping of elements
-returned in each iteration is visible if this iterator is being used
-to build a slice. While building a list, the items will be flattened.
+Used to iterator over a flat list (the context supplied by a slurpy binding).
+Returns the next element from the iterator after flattening any leading parcel.
 
-When it runs out of items, it will fail with the C exception.
+When it runs out of elements, it will fail with the C exception.
 As with most failures, it is generally returned without throwing it,
 unless the calling lexical scope requests it to be thrown via "use fatal".
 No list should ever contain the C exception, since iterational
 control flow should always terminate when that value is returned.
 
-This method provides list context to the iterator.
+=head2 method batch ($max?) {...}
 
-=head2 method getsome ($max?) {...}
+Used to iterate over a flat list when you wish to return an arbitrary
+number of elements at a time.  The returned set of elements is guaranteed
+not to contain any C objects, since any such C will
+be flattened before returning its elements.
 
-Returns a batch of items in some appropriate C type that
+Returns the batch of elements in some appropriate C type that
 numerifies to the exact number of items returned. (The type may also
 be C in its turn.)  Also returns C if no arguments
 are available; the C exception should return 0 when numerified
-to facilitate numeric end testing if that is desired.
+to facilitate numeric end testing if that is desired.  If C<$max> is
+not supplied, the iterator may choose a suitable batch size.
 
 This method provides list context to the iterator.
 
-=head2 method getitem {...}
+=head2 method getobj {...}
 
-Returns the next item for that iteration. The grouping of elements
-returned in each iteration is visible if this iterator is being used
-to build a slice. While building a list, the items will be flattened.
+Returns the next parcel or other object from the iterator without
+any flattening.  It is used both for binding to positional parameters
+in item context as well as variadically retrieving slice elements in
+slice context.
 
-When it runs out of items, it will fail with the C exception.
+When it runs out of objects, it will fail with the C exception.
 As with most failures, it is generally returned without throwing it,
 unless the calling lexical scope requests it to be thrown via "use fatal".
 No list should ever contain the C exception, since iterational
 control flow should always terminate when that value is returned.
 
-This method provides item context to the iterator, which is also
-used as slice context in the variadic region.
+=head2 method batchobj ($max?) {...}
 
-=head2 method getsomeitems ($max?) {...}
-
-Returns a batch of items in some appropriate C type that
+Returns a batch of parcels/objects in some appropriate C type that
 numerifies to the exact number of items returned. (The type may also
 be C in its turn.)  Also returns C if no arguments
 are available; the C exception should return 0 when numerified
-to facilitate numeric end testing if that is desired.
+to facilitate numeric end testing if that is desired.  If C<$max> is
+not supplied, the iterator may choose a suitable batch size.
 
-This method provides item context to the iterator, which is also
-used as slice context in the variadic region.
-
 =head1 The List::PushBack Role
 
 This role defines an iterator that knows how to receive values back to