r29754 - docs/Perl6/Spec
Author: lwall Date: 2010-02-16 21:14:32 +0100 (Tue, 16 Feb 2010) New Revision: 29754 Modified: docs/Perl6/Spec/S02-bits.pod docs/Perl6/Spec/S06-routines.pod docs/Perl6/Spec/S07-iterators.pod Log: [Spec] s/getobj/getarg/ to be slightly more accurate Modified: docs/Perl6/Spec/S02-bits.pod === --- docs/Perl6/Spec/S02-bits.pod2010-02-16 17:33:04 UTC (rev 29753) +++ docs/Perl6/Spec/S02-bits.pod2010-02-16 20:14:32 UTC (rev 29754) @@ -1863,8 +1863,8 @@ If a C is bound to an individual parameter, the behavior depends on whether the parameter is "slicey" or "slurpy". Positional -parameters and slice parameters call C<.getobj> on the internal -iterator and just return the next item or parcel without flattening. +parameters and slice parameters call C<.getarg> on the internal +iterator and just return the next syntactic argument (parcel or other object) without flattening. (Such a parcel transmutes to a C object.) Slurpy parameters call C<.get> on the internal iterator, which flattens any subparcels before pulling out the next item. In either case, no bare parcel Modified: docs/Perl6/Spec/S06-routines.pod === --- docs/Perl6/Spec/S06-routines.pod2010-02-16 17:33:04 UTC (rev 29753) +++ docs/Perl6/Spec/S06-routines.pod2010-02-16 20:14:32 UTC (rev 29754) @@ -1009,8 +1009,9 @@ method foo (*...@slice) { ... } 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. +requesting parcels when binding (underlyingly calling C<.getarg>) rather +than requesting individual elements as the flatening C<*> does (underlyingly +calling C<.get>). =head2 Zero-dimensional argument list Modified: docs/Perl6/Spec/S07-iterators.pod === --- docs/Perl6/Spec/S07-iterators.pod 2010-02-16 17:33:04 UTC (rev 29753) +++ docs/Perl6/Spec/S07-iterators.pod 2010-02-16 20:14:32 UTC (rev 29754) @@ -209,7 +209,7 @@ This method provides list context to the iterator. -=head2 method getobj {...} +=head2 method getarg {...} Returns the next parcel or other object from the iterator without any flattening. It is used both for binding to positional parameters @@ -222,11 +222,11 @@ 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 +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?) {...} +=head2 method batcharg ($max?) {...} Returns a batch of parcels/objects in some appropriate C type that numerifies to the exact number of items returned. (The type may also @@ -240,15 +240,15 @@ 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>. +whether you call C<.get> or C<.getarg>. =head2 method slice {...} -This returns an iterator that always anti-flattens by calling C<.getobj> internally, +This returns an iterator that always anti-flattens by calling C<.getarg> 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>. +whether you call C<.get> or C<.getarg>. =head1 The List::PushBack Role
r29760 - docs/Perl6/Spec
Author: lwall Date: 2010-02-17 02:01:45 +0100 (Wed, 17 Feb 2010) New Revision: 29760 Modified: docs/Perl6/Spec/S04-control.pod Log: [S04] bring gather/take description more in line with modern realities Modified: docs/Perl6/Spec/S04-control.pod === --- docs/Perl6/Spec/S04-control.pod 2010-02-16 23:43:09 UTC (rev 29759) +++ docs/Perl6/Spec/S04-control.pod 2010-02-17 01:01:45 UTC (rev 29760) @@ -13,8 +13,8 @@ Created: 19 Aug 2004 -Last Modified: 17 Dec 2009 -Version: 93 +Last Modified: 16 Feb 2010 +Version: 94 This document summarizes Apocalypse 4, which covers the block and statement syntax of Perl. @@ -683,28 +683,40 @@ =head2 The C statement prefix XX -A variant of C is C. Like C, it is followed by a -statement or block, and executes it once. Unlike C, it evaluates -the statement or block in sink (void) context; its return value is instead -specified by calling the C list prefix operator one or more times -within the dynamic scope of the C. The C function's -signature is like that of C; it merely wraps up a C -of its arguments without imposing any additional constraints (in the -absence of context propagation by the optimizer). The value returned -by the C to its own context is that same C object (which -is ignored when the C is in sink context). Regardless of the -C's context, the C object is also added to the list of -values being gathered, which is returned by the C in the form -of a lazy list of Cs, with each element corresponding to one C -parcel. (A Cs is normally flattened when bound into slurpy context, -but when bound into a slice context, the C objects become real -sublists. The eventual binding context thus determines whether to -throw away or keep the groupings resulting from each individual C call.) +A variant of C is C. Like C, it is followed by a statement +or block, and executes it once. Unlike C, it evaluates the statement or +block in sink (void) context; its return value is instead specified by calling +the C list prefix operator one or more times within the dynamic scope of +the C. The C function's signature is like that of C; +while having the syntax of a list operator, it merely returns a single item +which if, if you return multiple items in a comma list, be wrapped up in a +C object. No additional constraints are enforce by context, since +all context is lazy in Perl 6. The flattening or non-flattening of any such +returned C will be dependent on how the gather's return iterator is +iterated (with .get vs .getarg). +The value returned by the C to the C's own context is +that same returned object (which is ignored when the C is in +sink context). Regardless of the C's immediate context, the +object returned is also added to the list of values being gathered, +which is returned by the C in the form of a lazy list (that +is, an iterator, really), with each element of that list corresponding +to one C object (either a C or any other single object +serving as a degenerate parcel). + +Any Cs in the returned list are normally flattened when bound +into slurpy context. When bound into a slice context, however, +the C objects become real C objects that keep their +identity as discrete sublists. The eventual binding context thus +determines whether to throw away or keep the groupings resulting from +each individual C call. Since most list contexts are flat +rather than sliced, the boundaries between individual C +calls usually disappear. + Because C evaluates its block or statement in sink context, this typically causes the C function to be evaluated in sink context. However, a C function that is not in sink context -gathers its arguments I and also returns them unchanged. +gathers its return objects I and also returns them unchanged. This makes it easy to keep track of what you last "took": my @uniq = gather for @list { @@ -720,24 +732,24 @@ my @y; @x = gather for 1..2 { # flat context for list of parcels -my $x = take $_, $_ * 10; # item context for individual parcel -push @y, $x; +my ($y) := take $_, $_ * 10; # item context promotes parcel to seq +push @y, $y; } -# @x contains 4 Ints: 1,10,2,20 -# @y contains 2 Parcels: (1,10),(2,20) +# @x contains 4 Ints: 1,10,2,20 flattened by list assignment to @x +# @y contains 2 Seqs: Seq(1,10),Seq(2,20) sliced by binding to positional $y -Likewise, we can just remember the gather's result by binding and -later coerce it: +Likewise, we can just remember the gather's result parcel by binding and +later coercing it: -$c := gather for 1..2 { +my |$c := gather for 1..2 { take $_, $_ * 10; } # $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
Parrot 2.1.0 Released!
"One must command from each what each can perform, the king went on. "Authority is based first of all upon reason. If you command your subjects to jump into the ocean, there will be a revolution. I am entitled to command obedience because my orders are reasonable." "Then my sunset?" insisted the little prince, who never let go of a question once he had asked it. "You shall have your sunset. I shall command it. But I shall wait, according to my science of government, until conditions are favorable." — Antoine de Saint-Exupéry, The Little Prince On behalf of the Parrot team, I'm proud to announce Parrot 2.1.0 "As Scheduled." Parrot is a virtual machine aimed at running all dynamic languages. Parrot 2.1.0 is available on Parrot's FTP site, or follow the download instructions. For those who would like to develop on Parrot, or help develop Parrot itself, we recommend using Subversion on our source code repository to get the latest and best Parrot code. Parrot 2.1.0 News: - Core changes + GC performance and encapsulation were greatly improved. + PMC freeze refactored. + More Makefile and build improvements. - API Changes + The Array PMC was removed. + Several deprecated vtables were removed. + The OrderedHash PMC was substantialy improved. - Platforms + Packaging improvements on some operating systems. - Tools + Some cases in pbc_merge are now handled. + Improvements were made to the dependency checker. + New tool nativecall.pir added. Thanks to all our contributors for making this possible, and our sponsors for supporting this project. Our next release is 16 March 2010. Enjoy!