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.pod 2010-03-30 18:11:56 UTC (rev 30241) +++ docs/Perl6/Spec/S02-bits.pod 2010-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<junction> 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<type object>. 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) Cool Perl 6 Convenient OO Loopbacks Whatever Wildcard (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<Failure> role. Use C<fail> to return specific failures. Use C<Mu> for the most generic non-failure undefined value. The C<Any> type, -derived from C<Mu>, is also undefined, but excludes C<junctions> so +derived from C<Mu>, is also undefined, but excludes C<Junction> and C<Each> types so that autothreading may be dispatched using normal multiple dispatch rules. All user-defined classes derive from the C<Any> class by default. The C<Whatever> type is derived from C<Any> but nothing else Modified: docs/Perl6/Spec/S09-data.pod =================================================================== --- docs/Perl6/Spec/S09-data.pod 2010-03-30 18:11:56 UTC (rev 30241) +++ docs/Perl6/Spec/S09-data.pod 2010-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<junction> type, that routine is "autothreaded", meaning the routine +C<Junction> 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<Each> 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<each()> -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<Each> 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