Re: [svn:perl6-synopsis] r9216 - doc/trunk/design/syn

2006-05-13 Thread Larry Wall
On Sat, May 13, 2006 at 10:52:00AM +0300, Markus Laire wrote:
: On 5/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
: > Argumentless C<**> in a multi-dimensional subscript indicates 0 or
: >-more dimensions of C<*> where the number of dimension isn't necessarily
: >-known: C<@foo[1;**;5]>.  It has a value of C, or something
: >-like that.  The argumentless C<*> and C<**> forms are probably only
: >-useful in "dimensional" list contexts.
: 
: Is there any new format to do the equivalent of C<@foo[1;**;5]>, or is
: that impossible nowadays?

Considering we still have * for Whatever, I don't see any problem with
letting ** still mean MultiDim of Whatever.  In fact, we've made it easier
now.  I was deleting it from S03 only because it's not an argumentless operator
anymore, but a lowly term.  Probably about time to revisit S09 again...

Larry


Re: [svn:perl6-synopsis] r9216 - doc/trunk/design/syn

2006-05-13 Thread Markus Laire

On 5/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

 Argumentless C<**> in a multi-dimensional subscript indicates 0 or
-more dimensions of C<*> where the number of dimension isn't necessarily
-known: C<@foo[1;**;5]>.  It has a value of C, or something
-like that.  The argumentless C<*> and C<**> forms are probably only
-useful in "dimensional" list contexts.


Is there any new format to do the equivalent of C<@foo[1;**;5]>, or is
that impossible nowadays?

--
Markus Laire


Re: [svn:perl6-synopsis] r9216 - doc/trunk/design/syn

2006-05-12 Thread Daniel Hulme
>  (string) context.  You can force list context on the expression using
> -either the C<*> or C operator if necessary.
> +either the C operator if necessary.
English not being executable line noise, you can't use "either" to force
a scalar into list context.

-- 
"Twelve? Who needs twelve? Couldn't we make do with six?"  -- Lew Grade,
   trying to cut production costs on 'Jesus of Nazareth'
  "The illegal we do immediately,
the unconstitutional takes a little longer."  Henry Kissinger, June 1972


pgpG2UJJQyQfV.pgp
Description: PGP signature


[svn:perl6-synopsis] r9216 - doc/trunk/design/syn

2006-05-12 Thread larry
Author: larry
Date: Fri May 12 14:55:00 2006
New Revision: 9216

Modified:
   doc/trunk/design/syn/S02.pod
   doc/trunk/design/syn/S03.pod
   doc/trunk/design/syn/S06.pod

Log:
Major whackage: Prefix * and ** are dead!  Long live [,] and eager!
By unpopular demand, reduce operators no longer triangulate in list context.
(Triangulate explicitly using [\*] instead.)


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri May 12 14:55:00 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 8 May 2006
+  Last Modified: 12 May 2006
   Number: 2
-  Version: 39
+  Version: 40
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -476,6 +476,41 @@
 Note, though, that if you remap a section of C memory to be
 C, you'll have to multiply all your positions by 4.
 
+=item *
+
+Ordinarily a term beginning with C<*> indicates a global function
+or type name, but by itself, the C<*> term captures the notion of
+"Whatever", which is applied lazily by whatever operator it is an
+argument to.  Generally it can just be thought of as a "glob" that
+gives you everything it can in that argument position.  For instance:
+
+if $x ~~ 1..* {...}# if 1 <= $x <= +Inf
+my ($a,$b,$c) = "foo" xx *;# an arbitrary long list of 
"foo"
+if /foo/ ff * {...}# a latching flipflop
+@slice = @x[*;0;*];# any Int
+@slice = %x{*;'foo'};  # any keys in domain of 1st dimension
+@array[*]  # flattens, unlike @array[]
+(*, *, $x) = (1, 2, 3);# skip first two elements
+   # (same as lvalue "undef" in Perl 5)
+
+C is an undefined prototype object derived from C.  As a
+type it is abstract, and may not be instantiated as a defined object.
+If for a particular MMD dispatch, nothing in the MMD system claims it,
+it dispatches to as an C with an undefined value, and usually
+blows up constructively.  If you say
+
+say 1 + *;
+
+you should probably not expect it to yield a reasonable answer, unless
+you think an exception is reasonable.  Since the C object
+is effectively immutable, the optimizer is free to recognize C<*>
+and optimize in the context of what operator it is being passed to.
+
+Other uses for C<*> will doubtless suggest themselves over time.  These
+can be given meaning via the MMD system, if not the compiler.  In general
+a C should be interpreted as maximizing the degrees of freedom
+in a dwimmey way, not as a nihilistic "don't care anymore--just shoot me".
+
 =back
 
 =head1 Names and Variables
@@ -982,9 +1017,9 @@
 =item *
 
 Truly global variables live in the C<*> package: C<$*UID>, C<%*ENV>.
-(The C<*> may generally be omitted if there is no inner declaration
-hiding the global name.)  C<$*foo> is short for C<$*::foo>, suggesting
-that the variable is "wild carded" into every package.
+(The C<*> may be omitted if you import the name from the C
+package.)  C<$*foo> is short for C<$*::foo>, suggesting that the
+variable is "wild carded" into every package.
 
 =item *
 
@@ -1483,7 +1518,7 @@
 not be followed by any dereferencers, since you can always put them
 inside the closure.  The expression inside is evaluated in scalar
 (string) context.  You can force list context on the expression using
-either the C<*> or C operator if necessary.
+either the C operator if necessary.
 
 The following means the same as the previous example.
 
@@ -1850,39 +1885,22 @@
 its arguments even if C itself occurs in a scalar context.
 In list context, it flattens lazily.  In a scalar context, it returns
 the resulting list as a single C object.  (So the C operator
-really does exactly the same thing as putting a list in parentheses.
-But it's more readable in some situations.)
+really does exactly the same thing as putting a list in parentheses with
+at least one comma.  But it's more readable in some situations.)
 
 =item *
 
-The C<*> unary operator may be used to force list context on its
+The C<[,]> list operator may be used to force list context on its
 argument and I defeat any scalar argument checking imposed by
 subroutine signature declarations.  This list flattens lazily.
-When applied to a scalar value containing an iterator, C<*> causes
-the iterator's return values be interpolated into the list lazily.
-Note that C<*> is destructive when applied to a scalar iterator,
-but non-destructive when applied to an array, even if that array
-represents an iterator.
-
-There is an argumentless form of C<*> which may be used within a
-multi-dimensional array or hash subscript to indicate all of the
-current set of subscripts available for this dimension.  It actu