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

2006-02-23 Thread larry
Author: larry
Date: Thu Feb 23 06:15:20 2006
New Revision: 7795

Modified:
   doc/trunk/design/syn/S12.pod
Log:
Typo, plus audrey forgot to increment version.


Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podThu Feb 23 06:15:20 2006
@@ -12,9 +12,9 @@ Larry Wall <[EMAIL PROTECTED]>
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 22 Feb 2006
+  Last Modified: 23 Feb 2006
   Number: 12
-  Version: 9
+  Version: 10
 
 =head1 Overview
 
@@ -310,7 +310,7 @@ which as a singleton object knows your p
 our $count;
 method ^count { return $count }
 
-Such an I is always delegated to C<.meta> just as method like
+Such a I is always delegated to C<.meta> just as method like
 C<.does> are, so it's possible to call this as C or C<$dog.count>.
 However, best practice is probably to call such a class method as C
 or C<$dog.^count> to make it clear that it's in its own namespace separate


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

2006-02-24 Thread larry
Author: larry
Date: Thu Feb 23 15:04:02 2006
New Revision: 7819

Modified:
   doc/trunk/design/syn/S11.pod
Log:
fix typo and date++, rev++


Modified: doc/trunk/design/syn/S11.pod
==
--- doc/trunk/design/syn/S11.pod(original)
+++ doc/trunk/design/syn/S11.podThu Feb 23 15:04:02 2006
@@ -12,9 +12,9 @@ Larry Wall <[EMAIL PROTECTED]>
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 22 Feb 2006
+  Last Modified: 23 Feb 2006
   Number: 11
-  Version: 8
+  Version: 9
 
 =head1 Overview
 
@@ -127,7 +127,7 @@ It is also possible to re-export the imp
 
 use Sense :EXPORT;  # import and re-export the defaults
 use Sense  :EXPORT; # import "common" and re-export it
-use Sense  :EXPORT<@horse>; # import "common" but exports "@horse"
+use Sense  :EXPORT<@horse>; # import "common" but export "@horse"
 
 In the absence of a specific scoping specified by the caller, the module
 may also specify a different scoping default by use of C<:MY> or C<:OUR>


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

2006-02-24 Thread larry
Author: larry
Date: Thu Feb 23 15:05:58 2006
New Revision: 7821

Modified:
   doc/trunk/design/syn/S12.pod
Log:
another typo


Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podThu Feb 23 15:05:58 2006
@@ -310,7 +310,7 @@ which as a singleton object knows your p
 our $count;
 method ^count { return $count }
 
-Such a I is always delegated to C<.meta> just as method like
+Such a I is always delegated to C<.meta> just as methods like
 C<.does> are, so it's possible to call this as C or C<$dog.count>.
 However, best practice is probably to call such a class method as C
 or C<$dog.^count> to make it clear that it's in its own namespace separate


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

2006-02-24 Thread larry
Author: larry
Date: Fri Feb 24 13:06:51 2006
New Revision: 7856

Modified:
   doc/trunk/design/syn/S06.pod
Log:
Revamped quasiquoting for visual, nestable, non-code-interfering unquoting.


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri Feb 24 13:06:51 2006
@@ -13,9 +13,9 @@ Allison Randal <[EMAIL PROTECTED]>
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 23 Feb 2006
+  Last Modified: 24 Feb 2006
   Number: 6
-  Version: 17
+  Version: 18
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1862,13 +1862,16 @@ original language and know which parts o
 from which parts of the user's view of the program.
 
 In aid of returning syntax tree, Perl provides a "quasiquoting"
-mechanism using the keyword "CODE", followed by a block intended to
+mechanism using the quote C, followed by a block intended to
 represent an AST:
 
-return CODE { say $a };
+return q:code { say $a };
 
-[Conjecture: Other keywords are possible if we have more than one
-AST type.]
+Modifiers to the C<:code> adverb can modify the operation:
+
+:ast(MyAst)# Default :ast(AST)
+:lang(Ruby)# Default :lang($?PARSER)
+:unquote<[: :]># Default "triple rule"
 
 Within a quasiquote, variable and function names resolve first of
 all according to the lexical scope of the macro definition, and if
@@ -1876,41 +1879,57 @@ unrecognized in that scope, are assumed 
 of the macro call each time it is called.  If they cannot be bound
 from the scope of the macro call, a compile-time exception is thrown.
 
-Variables that resolve from the lexical scope of the macro definition
-will be inserted appropriately depending on the type of the variable,
-which may be either a syntax tree or a string.  (Again, syntax tree
-is preferred.)  The case is similar to that of a macro called from
-within the quasiquote, insofar as reparsing only happens with the
-string version of interpolation, except that such a reparse happens
-at macro call time rather than macro definition time, so its result
-cannot change the parser's expectations about what follows the
-interpolated variable.
+Bare AST variables (such as the arguments to the macro) may not be
+spliced directly into a quasiquote because they would be taken as
+normal bindings.  Likewise, program text strings to be inserted need
+to be specially marked or they will be bound normally.  To insert a
+"unquoted" expression of either type within a quasiquote, use the
+quasiquote delimiter tripled, typically a bracketing quote of some sort:
+
+return q:code { say $a + {{{ $ast }}} }
+return q:code [ say $a + [[[ $ast ]]] ]
+return q:code < say $a + <<< $ast >>> >
+return q:code ( say $a + ((( $ast ))) )
+
+(Note to implementors: this must not be implemented by finding
+the final closing delimiter and preprocessing, or we'll violate our
+one-pass parsing rule.  Perl 6 parsing rules are parameterized to know
+their closing delimiter, so adding the opening delimiter should not
+be a hardship.  Alternately the opening delimiter can be deduced from
+the closing delimiter.  Writing a rule that looks for three opening
+delimiters in a row should not be a problem.  It has to be a special
+grammar rule, though, not a fixed token, since we need to be able to
+nest code blocks with different delimiters.  Likewise when parsing the
+inner expression, the inner parser rule is parameterized to know that
+C<}}}> or whatever is its closing delimiter.)
+
+The delimiters don't have to be bracketing quotes, but the following
+is probably to be construed as Bad Style:
+
+return q:code / say $a + /// $ast /// /
+
+Dequoted expressions are inserted appropriately depending on the
+type of the variable, which may be either a syntax tree or a string.
+(Again, syntax tree is preferred.)  The case is similar to that of a
+macro called from within the quasiquote, insofar as reparsing only
+happens with the string version of interpolation, except that such
+a reparse happens at macro call time rather than macro definition
+time, so its result cannot change the parser's expectations about
+what follows the interpolated variable.
 
 Hence, while the quasiquote itself is being parsed, the syntactic
-interpolation of a variable into the quasiquote always results in
-the expectation of an operator following the variable.  (You must
-use a call to a submacro if you want to expect something else.)
-Of course, the macro definition as a whole can expect whatever it
-likes afterwards, according to its syntactic category.  (Generally,
-a term expects a following postfix or infix operator, and an operator
-expects a following term or prefix ope

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

2006-02-25 Thread larry
Author: larry
Date: Fri Feb 24 16:04:13 2006
New Revision: 7860

Modified:
   doc/trunk/design/syn/S05.pod

Log:
* Added $() access to "result" object.
* Added <( pat )> matcher to capture simple result object.
* Changed old <(...)> assertion to  and ,
which is more consistent with other callouts to code.


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podFri Feb 24 16:04:13 2006
@@ -13,9 +13,9 @@
 
Maintainer: Patrick Michaud <[EMAIL PROTECTED]>
Date: 24 Jun 2002
-   Last Modified: 24 Feb 2006
+   Last Modified: 25 Feb 2006
Number: 5
-   Version: 10
+   Version: 11
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them "rules" because they haven't been
@@ -613,24 +613,40 @@
 
 =item *
 
-A leading C<(> indicates a code assertion:
+A leading C or Cindicates a code assertion:
 
- / (\d**{1..3}) <( $0 < 256 )> /
+ / (\d**{1..3})  /
+ / (\d**{1..3})  /
 
 Similar to:
 
  / (\d**{1..3}) { $0 < 256 or fail } /
+ / (\d**{1..3}) { $0 < 256 and fail } /
 
 Unlike closures, code assertions are not guaranteed to be run at the
 canonical time if the optimizer can prove something later can't match.
 So you can sneak in a call to a non-canonical closure that way:
 
- /^foo .* <( do { say "Got here!" } or 1 )> .* bar$/
+ /^foo .*  .* bar$/
 
 The C block is unlikely to run unless the string ends with "C".
 
 =item *
 
+A leading C<(> indicates the start of a result capture:
+
+/ foo <( \d+ )> bar /
+
+is equivalent to:
+
+/  \d+  /
+
+except that the scan for "foo" can be done in the forward direction,
+when a lookbehind assertion would scan for \d+ and then match "foo"
+backwards.
+
+=item *
+
 A leading C<[> or C<+> indicates an enumerated character class.  Ranges
 in enumerated character classes are indicated with C<..>.
 
@@ -1041,14 +1057,19 @@
 
 =item *
 
-A match always returns a "match object", which is also available as
-(lexical) C<$/> (except within a closure lexically embedded in a rule,
-where C<$/> always refers to the current match, not any submatch done
-within the closure).
+A match always returns a "match object", which is also available
+as C<$/>, which is an environmental lexical declared in the outer
+subroutine that is calling the rule.  (A closure lexically embedded
+in a rule does not redeclare C<$/>, so C<$/> always refers to the
+current match, not any prior submatch done within the closure).
 
 =item *
 
-The match object evaluates differently in different contexts:
+Notionally, a match object contains (among other things) a boolean
+success value, a scalar "result object", an array of ordered submatch
+objects, and a hash of named submatch objects.  To provide convenient
+access to these various values, the match object evaluates differently
+in different contexts:
 
 =over
 
@@ -1083,7 +1104,7 @@
 
 =item *
 
-When used as a closure, a Match object evaluates to its underlying
+When called as a closure, a Match object evaluates to its underlying
 result object.  Usually this is just the entire match string, but
 you can override that by calling C inside a rule:
 
@@ -1093,6 +1114,18 @@
 # match succeeds -- ignore the rest of the rule
 }.();
 
+C<$()> is a shorthand for C<$/.()> or C<$/()>.  The result object
+may contain any object, not just a string.
+
+You may also capture a subset of the match as the result object using
+the C<< <(...)> construct:
+
+"foo123bar" ~~ / foo <( \d+ \> bar /
+say $();# says 123
+
+In this case the result object is always a string when doing string
+matching, and a list of one or more elements when doing array matching.
+
 =item *
 
 When used as an array, a Match object pretends to be an array of all
@@ -1175,9 +1208,19 @@
 incomplete C object (which can be modified via the internal C<$/>.
 For example:
 
- $str ~~ / foo# Match 'foo'
+$str ~~ / foo# Match 'foo'
{ $/ = 'bar' } # But pretend we matched 'bar'
  /;
+say $/;   # says 'bar'
+
+This is slightly dangerous, insofar as you might return something that
+does not behave like a C object to some context that requires
+one.  Fortunately, you normally just want to return a result object instead:
+
+$str ~~ / foo # Match 'foo'
+   { return 'bar' }   # But pretend we matched 'bar'
+ /;
+say $();  # says 'bar'
 
 =back
 


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

2006-02-25 Thread larry
Author: larry
Date: Sat Feb 25 00:29:54 2006
New Revision: 7863

Modified:
   doc/trunk/design/syn/S02.pod
   doc/trunk/design/syn/S03.pod
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S05.pod

Log:
Various tweaks and comments from TheDamian.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Feb 25 00:29:54 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 16 Feb 2006
+  Last Modified: 25 Feb 2006
   Number: 2
-  Version: 16
+  Version: 17
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -111,7 +111,7 @@
 =item *
 
 In support of OO encapsulation, there is a new fundamental datatype:
-B.  External access to opaque objects is always through method
+B.  External access to opaque objects is always through method
 calls, even for attributes.
 
 =item *
@@ -211,9 +211,11 @@
 
 =item *
 
-Perl 6 intrinsically supports big integers and rationals through
-its system of type declarations.  C automatically supports
-promotion to arbitrary precision.  C supports arbitrary precision
+Perl 6 intrinsically supports big integers and rationals through its
+system of type declarations.  C automatically supports promotion
+to arbitrary precision.  (C may support arbitrary-precision
+floating-point arithmatic, but is not required to unless we can do
+so portably and efficiently.)  C supports arbitrary precision
 rational arithmetic.  Value types like C and C imply
 the natural machine representation for integers and floating-point
 numbers, respectively, and do not promote to arbitrary precision.

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Feb 25 00:29:54 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 1 Feb 2006
+  Last Modified: 25 Feb 2006
   Number: 3
-  Version: 12
+  Version: 13
 
 =head1 Operator renaming
 
@@ -107,10 +107,10 @@
 of semantics.  Anywhere you used C<=~> before you now use C<~~>, but C<~~> is
 much more general now.  See L for details.  (To catch "brainos",
 the Perl 6 parser defines an C<< infix:<=~> >> macro which always fails at
-compile time with a message directing the user either to use C<~~> instead,
+compile time with a message directing the user either to use C<~~> or C<~=> 
instead,
 or to put a space between if they really wanted to assign a stringified value.)
 
-=item * Unary C<.> calls its single argument (which must be a method, or an
+=item * Unary C<.> calls its single argument (which must be a method, or a
 dereferencer for a hash or array) on C<$_>.
 
 =item * The C<..> range operator has variants with C<^> on either
@@ -118,10 +118,18 @@
 produces a Range object.  Range objects are lazy iterators, and can
 be interrogated for their current C<.min> and C<.max> values (which
 change as they are iterated).  Ranges are not autoreversing: C<2..1>
-is always a null range, as is C<1^..^2>.  However, smart matching
-against a Range object smartmatches the endpoints in the domain of
-the object being matched, so C<< 1.5 ~~ 1^..^2 >> is true.
-(But C<< 2.1 ~~ 1..2 >> is false.)
+is always a null range, as is C<1^..^2>.  To reverse a range use:
+
+2..1:by(-1)
+reverse 1..2
+
+(The C is preferred because it works for alphabetic ranges
+as well.)
+
+Because C objects are lazy, they do not automatically generate
+a list.  So smart matching against a Range object smartmatches the
+endpoints in the domain of the object being matched, so C<< 1.5 ~~
+1^..^2 >> is true.  (But C<< 2.1 ~~ 1..2 >> is false.)
 
 =item * The unary C<^> operator generates a range from C<0> up to
 one less than its argument.  so C<^4> is short for C<0..^4> or C<0..3>.
@@ -133,7 +141,7 @@
 
 =item * However, C<...> as a term is the "yada, yada, yada" operator,
 which is used as the body in function prototypes.  It complains
-bitterly if it is ever executed.  Actually, it calls C.  Variant
+bitterly (by calling C) if it is ever executed.  Variant
 C calls C, and C calls C.
 
 =item * In addition, to the ordinary C<.> method invocation, there are
@@ -432,7 +440,7 @@
 
 =head1 Precedence
 
-Perl 6 has 22 precedence levels (fewer than Perl 5):
+Perl 6 has 22 precedence levels (which is fewer than Perl 5):
 
 terms  42 "eek" $x /abc/ (1+2) a(1) :by(2) .meth listop
 method postfix . .+ .? .* .() .[] .{} .«» .=

Mo

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

2006-02-25 Thread larry
Author: larry
Date: Sat Feb 25 01:58:24 2006
New Revision: 7866

Modified:
   doc/trunk/design/syn/S05.pod

Log:
Fixed and clarified <(...)> definition.


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podSat Feb 25 01:58:24 2006
@@ -639,11 +639,16 @@
 
 is equivalent to:
 
-/  \d+  /
+/  \d+  /
 
 except that the scan for "foo" can be done in the forward direction,
-when a lookbehind assertion would scan for \d+ and then match "foo"
-backwards.
+while a lookbehind assertion would presumably scan for \d+ and then
+match "foo" backwards.  The use of C<< <(...)> >> affects only the
+meaning of the "result object" and the positions of the beginning and
+ending of the match.  That is, after the match above, C<$()> contains
+only the digits matched, and C<.pos> is pointing to after the digits.
+Other captures (named or numbered) are unaffected and may be accessed
+through C<$/>.
 
 =item *
 


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

2006-02-25 Thread larry
Author: larry
Date: Sat Feb 25 02:30:24 2006
New Revision: 7869

Modified:
   doc/trunk/design/syn/S04.pod

Log:
Example was still in superpositional Perl[5|6]. dconway++ lwall--


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podSat Feb 25 02:30:24 2006
@@ -210,9 +210,10 @@
 The list is evaluated lazily by default, so instead of using a C
 to read a file a line at a time as you would in Perl 5:
 
-while my $line = <$*IN> {...}
+while (my $line = ) {...}
 
-in Perl 6 you should use a C instead:
+in Perl 6 you should use a C (plus a unary C<=> "iterate the
+iterator" operator) instead:
 
 for =$*IN -> $line {...}
 


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

2006-03-11 Thread larry
Author: larry
Date: Sat Mar 11 08:53:07 2006
New Revision: 8104

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

Log:
Damian tweaks, and unresolved issue on piping something to itself.


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Mar 11 08:53:07 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 24 Feb 2006
+  Last Modified: 11 Mar 2006
   Number: 6
-  Version: 18
+  Version: 19
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -92,9 +92,9 @@
 
 sub say { print qq{"@_[]"\n}; }   # args appear in @_
 
-sub cap { $_ = uc $_ for @_ }   # Error: elements of @_ are constant
+sub cap { $_ = uc $_ for @_ }   # Error: elements of @_ are read-only
 
-If you need to modify the elements of C<@_>, declare it explicitly
+If you need to modify the elements of C<@_>, declare the array explicitly
 with the C trait:
 
 sub swap ([EMAIL PROTECTED] is rw) { @_[0,1] = @_[1,0] }
@@ -141,10 +141,13 @@
 
 sub foo;
 
-is a compile-time error in Perl 6 (for reasons explained in Apocalypse 6).
-
-Redefining a stub subroutine does not produce an error.  To redefine
-any other subroutine you must explicitly use the "C" trait.
+is a compile-time error in Perl 6 (because it would imply that the body of the
+subroutine extends from that statement to the end of the file, as C and
+C declarations do).
+
+Redefining a stub subroutine does not produce an error, but redefining
+an already-defined subroutine does. If you wish to redefine a defined sub,
+you must explicitly use the "C" trait.
 
 The C<...> is the "yadayadayada" operator, which is executable but returns
 a failure.  You can also use C to produce a warning, or C to
@@ -539,7 +542,7 @@
 =head2 Named parameters
 
 Named-only parameters follow any required or optional parameters in the
-signature. They are marked by a C<:>:
+signature. They are marked by a prefix C<:>:
 
 sub formalize($text, :$case, :$justify) {...}
 
@@ -547,6 +550,14 @@
 
 sub formalize($text, :case($case), :justify($justify)) {...}
 
+If the longhand form is used, the label name and variable name can be
+different:
+
+sub formalize($text, :case($required_case), :justify($justification)) {...}
+
+so that you can use more descriptive internal parameter names without
+imposing inconveniently long external labels on named arguments.
+
 Arguments that correspond to named parameters are evaluated in scalar
 context. They can only be passed by name, so it doesn't matter what
 order you pass them in, so long as they don't intermingle with any
@@ -706,13 +717,25 @@
 
 sub foo (*@;slices) { ... }
 
+Note that this is different from
+
+sub foo (\$slices) { ... }
+
+insofar as C<\$slices> 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<*@;slices> 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 twigil so that constructs expecting multidimensional lists
+know that multidimensionality is the intention.
+
 It is allowed to specify a return type:
 
 sub foo (*@;slices --> Num) { ... }
 
 =head2 Pipe operators
 
-The variadic array of a subroutine call can be passed in separately
+The variadic list of a subroutine call can be passed in separately
 from the normal argument list, by using either of the "pipe" operators:
 C<< <== >> or C<< ==> >>.
 
@@ -782,6 +805,31 @@
 Since the pipe iterator is bound into the final variable, the variable
 can be just as lazy as the pipe that is producing the values.
 
+=begin Damian
+
+[DMC: On the other hand, these "push" semantics will break a very common
+  left-to-right processing pattern:
+
+  @data ==> grep { condition } ==> sort ==> @data;
+
+  It will also impose a very subtle distinction between the broken
+  symmetry of:
+
+  @data = sort <== grep { condition } <== @data;
+
+  and (the much more tempting, but almost certainly wrong):
+
+  @data <== sort <== grep { condition } <== @data;
+
+  Seems to me that we might be setting a trap here.
+
+  Could there be a special case that turns off "push" semantics in
+  any piped sequence where the origin is the same variable as the
+  destination???
+]
+
+=end Damian
+
 Because pipes are bound to arrays with "push" semantics, you can have
 a receiver for multiple pipes:
 
@@ -933,6 +981,8 @@
 
 @first_three = limited_grep 3, {$_<10}, @data;
 
+(The comma is requ

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

2006-03-17 Thread larry
Author: larry
Date: Fri Mar 17 15:41:25 2006
New Revision: 8336

Modified:
   doc/trunk/design/syn/S11.pod

Log:
Fixes from Damian
Clarification of default Perl package name
Clarification of when we need not default to Perl 5


Modified: doc/trunk/design/syn/S11.pod
==
--- doc/trunk/design/syn/S11.pod(original)
+++ doc/trunk/design/syn/S11.podFri Mar 17 15:41:25 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 23 Feb 2006
+  Last Modified: 17 Mar 2006
   Number: 11
-  Version: 9
+  Version: 10
 
 =head1 Overview
 
@@ -89,6 +89,8 @@
 the C above will bind as C<&Foo::EXPORT::DEFAULT::bar>,
 C<&Foo::EXPORT::ALL::bar>, and C<&Foo::EXPORT::others::bar>.
 
+Tagset names consisting entirely of capitals are reserved for Perl.
+
 Inner modules automatically add their export list to modules in all their
 outer scopes:
 
@@ -239,19 +241,31 @@
 
 use Perl-6;
 
-you're asking for any version of Perl 6.  Say:
+you're asking for any version of Perl 6.  You need to say:
 
 use Perl-6.0;
 use Perl-6.0.0;
 use Perl-6.2.7.1;
 
 if you want to lock in a particular set of semantics at some greater
-degree of specificity.  And some large company ever forks Perl, you can say
+degree of specificity.  And if some large company ever forks Perl, you can say
 
 use Perl-6-cpan:TPF
 
 to guarantee that you get the unembraced Perl.  C<:-)>
 
+Perl is the default module name, so
+
+use v6-cpan:TPF;
+
+means the same thing.  As a variant of that, the current Perl 5
+incantation to switch to Perl 6 parsing is
+
+use v6-pugs;
+
+(though in Perl 5 this actually ends up calling the v6.pm module with a
+'-pugs' argument for insane-but-useful reasons.)
+
 For wildcards any valid smartmatch selector works:
 
 use Dog-(1.2.1 | 1.3.4)-(/:i jrandom/);
@@ -273,7 +287,7 @@
 
 my Dog-1.3.4-cpan:JRANDOM $spot .= new("woof");
 
-The use statement actually allows a language on the front of a module name,
+The C statement actually allows a language on the front of a module name,
 so that you can use modules from other languages.  The language is separated
 by a colon.  For instance:
 
@@ -314,3 +328,7 @@
 a bare literal in a void context I to have produced a warning.
 (Invoking perl with C<-e6> has the same effect.)
 
+It's not necessary to force Perl 6 if the interpreter or command
+specified already implies it, such as use of a "C<#!/usr/bin/perl6>"
+shebang line.  Nor is it necessary to force Perl 6 in any file that
+beings with the "class" or "module" keywords.


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

2006-03-27 Thread larry
Author: larry
Date: Mon Mar 27 04:37:45 2006
New Revision: 8438

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

Log:
s/::/!!/


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podMon Mar 27 04:37:45 2006
@@ -269,7 +269,7 @@
 
 sub infix:<(c)> ($text, $owner) { return $text but Copyright($owner) }
 method prefix:<±> (Num $x) returns Num { return +$x | -$x }
-multi sub postfix: (Int $n) { $n < 2 ?? 1 :: $n*($n-1)! }
+multi sub postfix: (Int $n) { $n < 2 ?? 1 !! $n*($n-1)! }
 macro circumfix:«» ($text) is parsed / .*? / { "" }
 
 my $document = $text (c) $me;


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

2006-03-27 Thread larry
Author: larry
Date: Mon Mar 27 14:57:02 2006
New Revision: 8451

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

Log:
Added def of prototypes from audreyt++ (with clarification of scoping).


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podMon Mar 27 14:57:02 2006
@@ -37,6 +37,10 @@
 B (keyword: C) are routines that transcend class
 boundaries, and can have one or more invocants. 
 
+B (keyword: C) specify the commonalities (such
+as parameter names, fixity and associativity) shared by all multis
+of that name in the scope of the C declaration.
+
 B (keyword: C) are methods (of a grammar) that perform
 pattern matching. Their associated block has a special syntax (see
 Synopsis 5).


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

2006-03-27 Thread larry
Author: larry
Date: Mon Mar 27 15:40:15 2006
New Revision: 8453

Modified:
   doc/trunk/design/syn/S10.pod
   doc/trunk/design/syn/S12.pod
   doc/trunk/design/syn/S13.pod

Log:
Finally checking in the autoloading changes despite uncertainty about AUTODEF.


Modified: doc/trunk/design/syn/S10.pod
==
--- doc/trunk/design/syn/S10.pod(original)
+++ doc/trunk/design/syn/S10.podMon Mar 27 15:40:15 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 22 Feb 2006
+  Last Modified: 28 Mar 2006
   Number: 10
-  Version: 4
+  Version: 5
 
 =head1 Overview
 
@@ -36,7 +36,7 @@
 named subroutine declarations.
 
 As a special exception, if a braceless C declaration occurs
-as the first thing in a file, then it's taken to mean that the rest of
+as the first executable statement in a file, then it's taken to mean that the 
rest of
 the file is Perl 5 code.
 
 package Foo;   # the entire file is Perl 5
@@ -83,46 +83,105 @@
 
 =head1 Autoloading
 
-The package is the namespace that controls autoloading.  There is still
-an C hook that behaves as in Perl 5.  However, that is being
-replaced by various autoload hooks that distinguish declaration from
-definition, and various types from one another.  In particular:
-
-AUTOSCALAR
-AUTOARRAY
-AUTOHASH
-AUTOSUB
-AUTOMETH
-
-stand in for the declaration of objects; they are called when anyone
-is searching for a name in the package (or module, or class), and the
-name doesn't already exist in the package.  (In particular, C<.can>
-calls C when trying to determine if a class supports a
-particular method.)  The routines are expected to return a reference to
-an object of the proper sort (i.e. a variable, subroutine, or method
-reference), or undef if that name is not to be considered declared.
-That object need not be defined yet, though the routine is allowed
-to define it, and even install it into the symbol table if it likes.
+A package (or any other similar namespace) can control autoloading.
+However, Perl 5's C is being superseded by MMD autoloaders
+that distinguish declaration from definition, but are not restricted
+to declaring subs.  A run-time declarator multisub is declared as:
+
+multi CANDO ( MyPackage, $type, $name: *%args --> Container)
+
+which stands in for the declaration of a container object within
+another container object; it is called when anyone is searching for
+a name in the package (or module, or class), and the name doesn't
+already exist in the package.  (In particular, C<.can> calls C
+when trying to determine if a class supports a particular method.)
+The arguments to C include type information on what kind
+of object is expected in context, or this may be intuited from the
+name requested.  In any case, there may be multiple C routines
+that are dispatched via MMD:
+
+multi CANDO ( MyPackage, Item, $name: *%args --> Container)
+multi CANDO ( MyPackage, Array, $name: *%args --> Container)
+multi CANDO ( MyPackage, Hash, $name: *%args --> Container)
+multi CANDO ( MyPackage, Code, $name: *%args --> Container)
+
+The package itself is just passed as the
+first argument, since it's the container object.  Subsequent arguments
+identify the desired type of the inner container and the "name" or
+"key" by which the object is to be looked up in the outer container.
+Such a name does not include its container name, unlike Perl 5's magical
+C<$AUTOLOAD> variable.
+
+The C is expected to return a reference to an inner
+container object of the proper sort (i.e. a variable, subroutine,
+or method reference), or to a proxy object that can "autovivify"
+lazily, or undef if that name is not to be considered declared in the
+namespace in question.  The declaration merely defines the interface
+to the new object.  That object need not be completely defined yet,
+though the C routine is certainly I to define it
+eagerly, and even install the inner object into the outer container
+(the symbol table) if it wants to cache the declaration.
+
+At declaration time it might not yet be known whether the inner
+container object will be used in lvalue or rvalue context; the use
+of a proxy object can supply either readonly or rw semantics later.
+
+When the package in question is a class, it is also possible to declare 
+real methods or submethods:
+
+multi method CANDO ($self: Code, $name: *%args --> Container)
+
+multi submethod CANDO ($self: Item, $name: *%args --> Container)
+
+The method form is inherited by subclasses.  Submethods are never
+inherited but may still do MMD within the class.   (Ordinary multisubs
+are inherited only to the extent allowed by the MMD mechanism.)
+
+=for DISCUSSION
+The following should really be in S12 if really works this way, but

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

2006-03-27 Thread larry
Author: larry
Date: Mon Mar 27 15:45:03 2006
New Revision: 8454

Modified:
   doc/trunk/design/syn/S04.pod

Log:
Changed temp (and let) to not default to undefine() any more.


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon Mar 27 15:45:03 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 25 Feb 2006
+  Last Modified: 28 Mar 2006
   Number: 4
-  Version: 10
+  Version: 11
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -90,7 +90,16 @@
 value will be restored only if the current block exits unsuccessfully.
 (See Definition of Success below for more.)  C and C temporize
 or hypotheticalize the value or the variable depending on whether you
-do assignment or binding.
+do assignment or binding.  One other difference from Perl 5 is that
+the default is not to undefine a variable.  So
+
+temp $x;
+
+causes C<$x> to start with its current value.  Use
+
+temp undefine $x;
+
+to get the Perl 5 behavior.
 
 =head1 Statement-ending blocks
 


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

2006-03-27 Thread larry
Author: larry
Date: Mon Mar 27 19:28:57 2006
New Revision: 8457

Modified:
   doc/trunk/design/syn/S12.pod

Log:
s/undef/undefine/


Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podMon Mar 27 19:28:57 2006
@@ -762,7 +762,7 @@
 role Pet {
has $.collar = { Collar.new(Tag.new) };
method id () { return $.collar.tag }
-   method lose_collar () { undef $.collar }
+   method lose_collar () { undefine $.collar }
 }
 
 If you want to parameterize the initial value of a role attribute,


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

2006-03-31 Thread larry
Author: larry
Date: Fri Mar 31 07:36:42 2006
New Revision: 8512

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

Log:
Fix dates, typo.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Mar 31 07:36:42 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 12 Mar 2006
+  Last Modified: 1 Apr 2006
   Number: 2
-  Version: 17
+  Version: 18
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri Mar 31 07:36:42 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 11 Mar 2006
+  Last Modified: 1 Apr 2006
   Number: 6
-  Version: 19
+  Version: 20
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1246,7 +1246,7 @@
 
 =head2 Native types
 
-Values with these types autoboxes to their uppercase counterparts when
+Values with these types autobox to their uppercase counterparts when
 you treat them as objects:
 
 bit single native bit

Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podFri Mar 31 07:36:42 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 13 Sep 2004
-  Last Modified: 22 Nov 2005
+  Last Modified: 1 Apr 2006
   Number: 9
-  Version: 5
+  Version: 6
 
 =head1 Overview
 


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

2006-04-03 Thread larry
Author: larry
Date: Mon Apr  3 11:08:54 2006
New Revision: 8554

Modified:
   doc/trunk/design/syn/S05.pod

Log:
Mark Biggar points out that rule closure section had embedded closure verbiage.


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podMon Apr  3 11:08:54 2006
@@ -13,9 +13,9 @@
 
Maintainer: Patrick Michaud <[EMAIL PROTECTED]>
Date: 24 Jun 2002
-   Last Modified: 1 Apr 2006
+   Last Modified: 3 Apr 2006
Number: 5
-   Version: 13
+   Version: 14
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them "rules" because they haven't been
@@ -588,10 +588,11 @@
 
 The closure is guaranteed to be run at the canonical time.
 
-An B return from the closure binds the I for
-this match, ignores the rest of the current rule, and reports success:
+As with an ordinary embedded closure, an B return from a
+rule closure binds the I for this match, ignores the
+rest of the current rule, and reports success:
 
-   / (\d) { return $0.sqrt } NotReached /;
+   / (\d) <{ return $0.sqrt }> NotReached /;
 
 This has the effect of capturing the square root of the numified string,
 instead of the string.  The C part is not reached.


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

2006-04-03 Thread larry
Author: larry
Date: Mon Apr  3 15:59:38 2006
New Revision: 8556

Modified:
   doc/trunk/design/syn/S09.pod

Log:
Fixed P5isms in P6 code.


Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podMon Apr  3 15:59:38 2006
@@ -688,18 +688,18 @@
 In Perl 6 these read-only operations are indeed non-destructive:
 
 my %hash;
-exists $hash{foo}{bar}; # %hash is still empty
+exists %hash; # %hash is still empty
 
 But these ones I autovivify:
 
 my %hash;
-my $val := $hash{foo}{bar};
+my $val := %hash;
 
 my @array;
-my $ref = \$array[0][0]; # $ref is an Arguments object - see S02
+my $ref = [EMAIL PROTECTED]; # $ref is an Arguments object - see S02
 
 my %hash;
-$hash{foo}{bar} = "foo"; # duh
+%hash = "foo"; # duh
 
 This rule applies to C, C, and C container objects.
 


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

2006-04-05 Thread larry
Author: larry
Date: Wed Apr  5 10:19:49 2006
New Revision: 8561

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

Log:
Clarified identity and trivial properties for too-short reduce ops.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Apr  5 10:19:49 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 1 Apr 2006
+  Last Modified: 5 Apr 2006
   Number: 3
-  Version: 14
+  Version: 15
 
 =head1 Operator renaming
 
@@ -198,7 +198,7 @@
 
 =head1 Reduction operators
 
-The other metaoperator in Perl 6 is the reduction operator.  Any binary
+The other metaoperator in Perl 6 is the reduction operator.  Any infix
 operator can be surrounded by square brackets in term position to create
 a list operator that reduces using that operation:
 
@@ -216,13 +216,24 @@
 
 [<] 1, 3, 5;  # 1 < 3 < 5
 
-If no arguments are given, the operator calls C (returning
-C, or throwing an exception if C is in effect).  If
-exactly one argument is given, it is returned by default.  However, this
-default doesn't make sense for an operator like C<< < >> that doesn't
-return the same type as it takes, so these kinds of operators overload
-the single-argument case to return something more meaningful.  All the
-comparison operators return truth in this case.
+If no arguments are given, and if the infix operator defines
+an "identity" value property, that identity value is returned.
+(For instance, C<[*] @list> must return C<1> when C<@list> is empty.)
+In the absence of an identity value, the reduce metaoperator calls
+C (either returning C, or throwing an exception if C is in effect).
+
+If exactly one argument is given, it is returned by default.  However,
+this default doesn't make sense for an operator like C<< < >> that
+doesn't return the same type as it takes, so these kinds of operators
+overload the single-argument case to return something more meaningful.
+All the comparison operators return truth in this case.  This behavior
+is triggered by storage of the "trivial" value property on the infix
+operator.  (The trivial property is also returned for 0 arguments.)
+
+The identity and trivial properties are stored on the most general
+default variant of the infix operator, if there is more than
+one variant.  (Perhaps they can be returned simply by calling C<< infix:() 
>> and C<< infix:($x) >>, respectively, letting the defaults handle it.)
 
 This metaoperator can also be used on the semicolon second-dimension
 separator:


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

2006-04-05 Thread larry
Author: larry
Date: Wed Apr  5 15:37:22 2006
New Revision: 8562

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

Log:
Got rid of identity and trivial properties in favor of MMD definitions.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Apr  5 15:37:22 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 5 Apr 2006
   Number: 3
-  Version: 15
+  Version: 16
 
 =head1 Operator renaming
 
@@ -198,9 +198,10 @@
 
 =head1 Reduction operators
 
-The other metaoperator in Perl 6 is the reduction operator.  Any infix
-operator can be surrounded by square brackets in term position to create
-a list operator that reduces using that operation:
+The other metaoperator in Perl 6 is the reduction operator.  Any
+infix operator (except for non-associating operators and assignment
+operators) can be surrounded by square brackets in term position to
+create a list operator that reduces using that operation:
 
 [+] 1, 2, 3;  # 1 + 2 + 3 = 6
 my @a = (5,6);
@@ -216,30 +217,84 @@
 
 [<] 1, 3, 5;  # 1 < 3 < 5
 
-If no arguments are given, and if the infix operator defines
-an "identity" value property, that identity value is returned.
-(For instance, C<[*] @list> must return C<1> when C<@list> is empty.)
-In the absence of an identity value, the reduce metaoperator calls
-C (either returning C, or throwing an exception if C is in effect).
-
-If exactly one argument is given, it is returned by default.  However,
-this default doesn't make sense for an operator like C<< < >> that
-doesn't return the same type as it takes, so these kinds of operators
-overload the single-argument case to return something more meaningful.
-All the comparison operators return truth in this case.  This behavior
-is triggered by storage of the "trivial" value property on the infix
-operator.  (The trivial property is also returned for 0 arguments.)
-
-The identity and trivial properties are stored on the most general
-default variant of the infix operator, if there is more than
-one variant.  (Perhaps they can be returned simply by calling C<< infix:() 
>> and C<< infix:($x) >>, respectively, letting the defaults handle it.)
+If fewer than two arguments are given, one MMD attempt is made to
+dispatch to the operator anyway with whatever arguments are given.
+If this MMD dispatch succeeds, the result becomes the result of the
+of the reduce.
+
+Otherwise, if the MMD dispatch fails, then if there is one argument,
+that argument is returned.  However, this default doesn't make sense
+for an operator like C<< < >> that doesn't return the same type as it
+takes, so these kinds of operators overload the single-argument case
+to return something more meaningful.  All the comparison operators
+return a boolean for either 1 or 0 arguments.  Negated operators,
+return Bool::False, and all the rest return Bool::True.
+
+If no arguments were given, and the dispatch to the 0-ary form fails,
+the reduce as a whole fails.  Operators that wish to specify an identity
+value should do so by overloading the 0-ary variant.  Among the builtin
+operators, infix:<+>() returns 0 and infix:<*>() returns 1.  Note that,
+while the single argument form can MMD dispatch based on the type of
+the single argument, the 0-argument form cannot.
 
 This metaoperator can also be used on the semicolon second-dimension
 separator:
 
 [[;] 1,2,3]   # equivalent to [1;2;3]
 
+Builtin infix operators specify the following identity operations:
+
+multi sub infix:<**> () { 1 }   # arguably nonsensical
+multi sub infix:<*> ()  { 1 }
+multi sub infix: ()  { ??? } # reduce is nonsensical
+multi sub infix:<%> ()  { ??? } # reduce is nonsensical
+multi sub infix: ()  { ??? } # reduce is nonsensical
+multi sub infix: () { ??? } # reduce is nonsensical
+multi sub infix:<+&> () { +^0 } # -1 on 2's complement machine
+multi sub infix:{'+<'} ()   { ??? } # reduce is nonsensical
+multi sub infix:{'+>'} ()   { ??? } # reduce is nonsensical
+multi sub infix:<~&> () { ??? } # sensical but 1's length indeterminate
+multi sub infix:{'~<'} ()   { ??? } # reduce is nonsensical
+multi sub infix:{'~>'} ()   { ??? } # reduce is nonsensical
+multi sub infix:<+> ()  { 0 }
+multi sub infix:<-> ()  { 0 }
+multi sub infix:<~> ()  { '' }
+multi sub infix:<+|> () { 0 }
+multi sub infix:<+^> () { 0 }
+multi sub infix:<~|> () { '' } # length indeterminate but 0's default
+multi sub infix:<~^> ()   

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

2006-04-05 Thread larry
Author: larry
Date: Wed Apr  5 15:38:24 2006
New Revision: 8563

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

Log:
Documented grammatical categories.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr  5 15:38:24 2006
@@ -53,28 +53,38 @@
 
 =item *
 
-In general, whitespace is optional in Perl 6 except where it is
-needed to separate constructs that would be misconstrued as a single
-token or other syntactic unit.  (In other words, Perl 6 follows the
-standard "longest-token" principle, or in the cases of large constructs,
-a "prefer shifting to reducing" principle.)
+In general, whitespace is optional in Perl 6 except where it is needed
+to separate constructs that would be misconstrued as a single token or
+other syntactic unit.  (In other words, Perl 6 follows the standard
+"longest-token" principle, or in the cases of large constructs, a
+"prefer shifting to reducing" principle.  See Grammatical Categories
+below for more on how a Perl program is analyzed into tokens.)
 
 This is an unchanging deep rule, but the surface ramifications of it
 change as various operators and macros are added to or removed from
 the language, which we expect to happen because Perl 6 is designed to
 be a mutable language.  In particular, there is a natural conflict
-between postfix operators and infix operators, either of which may
-occur after a term.  If a given token may be interpreted as either a
-postfix operator or an infix operator, the infix operator requires
-space before it, and the postfix operator requires a lack of space
-before it, unless it begins with a dot.  (Infix operators may not
-start with a dot.)  For instance, if you were to add your own
-C<< infix:<++> >> operator, then it must have space before it, and the
-normal autoincrementing C<< postfix:<++> >> operator may not have
-space before it, or must be written as C<.++> instead.  In standard Perl
-6, however, it doesn't matter if you put a space in front of
-C<< postfix:<++> >>.  To be future proof, though, you should omit
-the space or use dot.
+between postfix operators and infix operators, either of which
+may occur after a term.  If a given token may be interpreted as
+either a postfix operator or an infix operator, the infix operator
+requires space before it, and the postfix operator requires a lack
+of space before it unless the previous token was follwed by a dot.
+(Infix operators may not start with a dot.)  In other words, the only
+way to put whitespace before a postfix operator is to put whitespace
+between a dot and the normal representation of the postfix operator.
+In other other words, a postfix operator starting with a dot is allowed
+to have any amount of whitespace between the dot and the rest of the
+postfix operator.
+
+For instance, if you were to add your own C<< infix:<++> >> operator,
+then it must have space before it, and the normal autoincrementing
+C<< postfix:<++> >> operator may not have space before it, or must
+be written as C<$x. ++> instead.  In standard Perl 6, however, it
+doesn't matter if you put a space in front of C<< postfix:<++> >>.
+To be future proof, though, you should omit the space or use dot.
+
+(A consequence of this rule is that a dot with whitespace in front of it
+is always considered a method call on C<$_>.)
 
 =item *
 
@@ -86,13 +96,13 @@
 =item *
 
 Multiline comments will be provided by extending the syntax of POD
-to nest C<=begin COMMENT>/C<=end COMMENT> correctly without the need
-for C<=cut>.  (Doesn't have to be "COMMENT"--any unrecognized POD
+to nest C<=begin comment>/C<=end comment> correctly without the need
+for C<=cut>.  (Doesn't have to be "comment"--any unrecognized POD
 stream will do to make it a comment.  Bare C<=begin> and C<=end>
 probably aren't good enough though, unless you want all your comments
 to end up in the manpage...)
 
-We have single paragraph comments with C<=for COMMENT> as well.
+We have single paragraph comments with C<=for comment> as well.
 That lets C<=for> keep its meaning as the equivalent of a C<=begin>
 and C<=end> combined.  As with C<=begin> and C<=end>, a comment started
 in code reverts to code afterwards.
@@ -261,11 +271,11 @@
 Perl 6 includes a system of B to mark the fundamental
 structural type of a variable:
 
-$  scalar
-@  ordered array
-%  unordered hash (associative array)
-&  code
-:: package/module/class/role/subset/enum/type
+$   scalar
+@   ordered array
+%   unordered hash (

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

2006-04-05 Thread larry
Author: larry
Date: Wed Apr  5 16:21:23 2006
New Revision: 8564

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

Log:
Additional clarifications on how to reduce non-infix ops.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr  5 16:21:23 2006
@@ -84,7 +84,8 @@
 To be future proof, though, you should omit the space or use dot.
 
 (A consequence of this rule is that a dot with whitespace in front of it
-is always considered a method call on C<$_>.)
+is always considered a method call on C<$_>.  If a term is not expected at
+this point, it is a syntax error.)
 
 =item *
 

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Apr  5 16:21:23 2006
@@ -295,6 +295,14 @@
 for an operation can call C to discover it.
 (There is no explicit identity property.)
 
+To call some other non-infix function as a reduce operator, you must
+define an alias in infix form.  The infix form will parse the right
+argument as a scalar even if the aliased function would have parsed it
+as a list:
+
+&infix: ::= postcircumfix:<{}>;
+$x = [dehash] $a,'foo','bar';  # $a, not $a
+
 =head1 Junctive operators
 
 C<|>, C<&>, and C<^> are no longer bitwise operators (see L

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

2006-04-05 Thread larry
Author: larry
Date: Wed Apr  5 16:30:06 2006
New Revision: 8565

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

Log:
More clarification of how reduce is parsed.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Apr  5 16:30:06 2006
@@ -300,9 +300,24 @@
 argument as a scalar even if the aliased function would have parsed it
 as a list:
 
-&infix: ::= postcircumfix:<{}>;
+&infix: ::= postcircumfix:<{ }>;
 $x = [dehash] $a,'foo','bar';  # $a, not $a
 
+Note that, because a reduce is a list operator, the argument list to is
+evaluated in list context.  Therefore the following would be incorrect:
+
+$x = [dehash] %a,'foo','bar';
+
+You'd instead have to say one of:
+
+$x = [dehash] \%a,'foo','bar';
+$x = [dehash] %a,'bar';
+
+On the plus side, this works without a star:
+
+@args = (\%a,'foo','bar');
+$x = [dehash] @args;
+
 =head1 Junctive operators
 
 C<|>, C<&>, and C<^> are no longer bitwise operators (see L

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

2006-04-05 Thread larry
Author: larry
Date: Wed Apr  5 16:37:32 2006
New Revision: 8566

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

Log:
Typo, plus explicate [.foo] meaning.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Apr  5 16:37:32 2006
@@ -303,7 +303,7 @@
 &infix: ::= postcircumfix:<{ }>;
 $x = [dehash] $a,'foo','bar';  # $a, not $a
 
-Note that, because a reduce is a list operator, the argument list to is
+Note that, because a reduce is a list operator, the argument list is
 evaluated in list context.  Therefore the following would be incorrect:
 
 $x = [dehash] %a,'foo','bar';
@@ -318,6 +318,9 @@
 @args = (\%a,'foo','bar');
 $x = [dehash] @args;
 
+Note also that C<[.foo]> always means C<[$_.foo]>, never a reduce operator.
+Infix operators are not allowed to start with a dot.
+
 =head1 Junctive operators
 
 C<|>, C<&>, and C<^> are no longer bitwise operators (see L

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

2006-04-07 Thread larry
Author: larry
Date: Fri Apr  7 11:53:34 2006
New Revision: 8607

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

Log:
Reduce now defined directly in terms of list operators, possibly autogenerated.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podFri Apr  7 11:53:34 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 5 Apr 2006
+  Last Modified: 7 Apr 2006
   Number: 3
-  Version: 17
+  Version: 18
 
 =head1 Operator renaming
 
@@ -118,8 +118,9 @@
 compile time with a message directing the user either to use C<~~> or C<~=> 
instead,
 or to put a space between if they really wanted to assign a stringified value.)
 
-=item * Unary C<.> calls its single argument (which must be a method, or a
-dereferencer for a hash or array) on C<$_>.
+=item * "Unary" C<.> calls its single argument (which must be a method, or a
+dereferencer for a hash or array) on C<$_>.  (It's not really a unary operator,
+so we put it in quotes.)
 
 =item * The C<..> range operator has variants with C<^> on either
 end to indicate exclusion of that endpoint from the range.  It always
@@ -146,11 +147,16 @@
 
 =item * C<...> is a unary postfix operator that constructs a semi-infinite
 (and lazily evaluated) list, starting at the value of its single argument.
+It should not have any trailing whitespace, or it will be confused with
+a "long dot".
 
-=item * However, C<...> as a term is the "yada, yada, yada" operator,
-which is used as the body in function prototypes.  It complains
-bitterly (by calling C) if it is ever executed.  Variant
-C calls C, and C calls C.
+=item * However, C<...> where a term is expected is the "yada,
+yada, yada" prefix operator, which is used as the body in function
+prototypes.  It complains bitterly (by calling C) if it is
+ever executed.  Variant C calls C, and C calls C.
+The argument is optional, but if provided, is passed onto the C,
+C, or C.  Otherwise the system will make up a message for
+you based on the context.
 
 =item * In addition, to the ordinary C<.> method invocation, there are
 variants C<.*>, C<.?>, and C<.+> to control how multiple parent methods
@@ -207,7 +213,44 @@
 my @a = (5,6);
 [*] @a;   # 5 * 6 = 30
 
-The reduction associates the same way as the operator used:
+A reduction operator really is a list operator, and is invoked as one.
+Hence, you maybe implement a reduction operator in one of two ways.  Either
+you can write an explicit list operator:
+
+proto prefix:<[+]> ([EMAIL PROTECTED]) {
+my $accum = 0;
+while (@args) {
+$accum += @args.shift();
+}
+return $accum;
+}
+
+or you can let the system autogenerate one for you based on the
+corresponding infix operator, probably by currying:
+
+# (examples, actual system may define prefix:[**] instead)
+&prefix:<[*]> ::= &reduce.assuming(&infix:<*>, 1);
+&prefix:<[**]> ::= &reducerev.assuming(&infix:<**>);
+
+As a special form of name, the non-prefix notation, as in
+
+proto [foo] ([EMAIL PROTECTED]) {
+...
+}
+
+or
+
+&[foo] ::= ...
+
+defines both the C<[foo]> reduce operator and the C infix operator.
+Where appropriate, use of the infix form may be optimized like this:
+
+$a foo $b   ===>[foo] $a, $b
+$a foo $b foo $c===>[foo] $a, $b, $c
+... ...
+
+If the reduction operator is defined separately from the infix operator,
+it must associate the same way as the operator used:
 
 [-] 4, 3, 2;  # 4-3-2 = (4-3)-2 = -1
 [**] 4, 3, 2; # 4**3**2 = 4**(3**2) = 262144
@@ -217,85 +260,88 @@
 
 [<] 1, 3, 5;  # 1 < 3 < 5
 
-If fewer than two arguments are given, one MMD attempt is made to
-dispatch to the operator anyway with whatever arguments are given.
-If this multi-dispatch succeeds, the result becomes the result of the
-reduce.
-
-Otherwise, if the dispatch fails, then if there is one argument,
-that argument is returned.  However, this default doesn't make sense
-for an operator like C<< < >> that doesn't return the same type as it
-takes, so these kinds of operators overload the single-argument case
+If fewer than two arguments are given, a dispatch is still attempted
+with whatever arguments are given, and it is up to the receiver of that
+dispatch to deal with fewer than two arguments.  Note that the proto
+list operator definition is the most general, so you are allowed to define
+different ways to handle the one argument case depending on type:
+
+multi prefix:<[foo]> (Int $x) { 42 }
+multi pref

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

2006-04-07 Thread larry
Author: larry
Date: Fri Apr  7 12:26:35 2006
New Revision: 8608

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

Log:
Simplified postfix/infix parsing policy to use "long dot".


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Apr  7 12:26:35 2006
@@ -67,25 +67,49 @@
 between postfix operators and infix operators, either of which
 may occur after a term.  If a given token may be interpreted as
 either a postfix operator or an infix operator, the infix operator
-requires space before it, and the postfix operator requires a lack
-of space before it unless the previous token was follwed by a dot.
-(Infix operators may not start with a dot.)  In other words, the only
-way to put whitespace before a postfix operator is to put whitespace
-between a dot and the normal representation of the postfix operator.
-In other other words, a postfix operator starting with a dot is allowed
-to have any amount of whitespace between the dot and the rest of the
-postfix operator.
+requires space before it.  Postfix operators may never have intervening
+space, though they may have an intervening dot, or a "long dot" that begins
+and ends with dots and contains whitespace and commentary between the dots.
+The pattern for "long dot" is C<< m:p/\.+ \s \./ >>.  (A minor
+consequence of this is that the C<< postfix:<...> >> operator should not
+be followed by whitespace.)
 
 For instance, if you were to add your own C<< infix:<++> >> operator,
-then it must have space before it, and the normal autoincrementing
-C<< postfix:<++> >> operator may not have space before it, or must
-be written as C<$x. ++> instead.  In standard Perl 6, however, it
-doesn't matter if you put a space in front of C<< postfix:<++> >>.
-To be future proof, though, you should omit the space or use dot.
-
-(A consequence of this rule is that a dot with whitespace in front of it
-is always considered a method call on C<$_>.  If a term is not expected at
-this point, it is a syntax error.)
+then it must have space before it. The normal autoincrementing
+C<< postfix:<++> >> operator may never have space before it, but may
+be written in any of these forms:
+
+$x++
+
+$x.++
+
+$x. .++
+
+$x... .++
+
+$x.. .++
+
+$x...
+.++
+
+$x...  # comment
+   # more comment
+.++
+
+$x...  # comment
+=begin podstuff
+whatever
+=end podstuff
+.++
+
+A consequence of this rule is that, in the absence of a "long dot",
+a dot with whitespace in front of it is always considered a method
+call on C<$_> where a term is expected.  If a term is not expected
+at this point, it is a syntax error.  (Unless, of course, there is
+an infix operator of that name beginning with dot.  You could define
+a Fortranly C<< infix:<.EQ.> >>, for instance, if the fit took you.
+But you'll have to be sure to always put whitespace in front of it, or
+it would be interpreted as a postfix method call instead.)
 
 =item *
 


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

2006-04-07 Thread larry
Author: larry
Date: Fri Apr  7 13:04:37 2006
New Revision: 8609

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

Log:
More long dot cleanup.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Apr  7 13:04:37 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 6 Apr 2006
+  Last Modified: 7 Apr 2006
   Number: 2
-  Version: 20
+  Version: 21
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -72,7 +72,9 @@
 and ends with dots and contains whitespace and commentary between the dots.
 The pattern for "long dot" is C<< m:p/\.+ \s \./ >>.  (A minor
 consequence of this is that the C<< postfix:<...> >> operator should not
-be followed by whitespace.)
+be followed by whitespace.  Also, if you put space after the C<..> range
+operator, it should have space before it as well.  But you already do it
+that way, right?)
 
 For instance, if you were to add your own C<< infix:<++> >> operator,
 then it must have space before it. The normal autoincrementing
@@ -111,6 +113,13 @@
 But you'll have to be sure to always put whitespace in front of it, or
 it would be interpreted as a postfix method call instead.)
 
+The long dot form of the C<...> postfix is C<0. ...> rather than
+C<0. > because the long dot eats the first dot after the whitespace.
+It does not follow that you can write C<0> because that would
+take the first three dots under the longest token rule.  (The long dot
+does not count as a longer token because the longest-token rule only
+applies to the fixed prefix of any rule with variable components.)
+
 =item *
 
 Single-line comments work as in Perl 5, starting with a C<#> character
@@ -381,10 +390,11 @@
 Subscripts now consistently dereference the container produced by
 whatever was to their left.  Whitespace is not allowed between a
 variable name and its subscript.  However, there is a corresponding
-B form of each subscript (C<@foo.[1]> and C<%bar.{'a'}>) which
-allows optional whitespace after the dot (except when interpolating).
-Constant string subscripts may be placed in angles, so C<%bar.{'a'}>
-may also be written as C<< %bar >> or C<< %bar. >>.
+B form of each subscript (C<@foo.[1]> and C<%bar.{'a'}>).
+There is also a "long dot" form which allows optional whitespace
+between dots. (The long dot is not allowed when interpolating).  Constant
+string subscripts may be placed in angles, so C<%bar.{'a'}> may also
+be written as C<< %bar >> or C<< %bar. >>.
 
 =item *
 
@@ -473,9 +483,11 @@
 &foo($arg1, $arg2);
 
 Whitespace is not allowed before the parens, but there is a corresponding
-C<.()> operator, which allows you to insert optional whitespace after the dot:
+C<.()> operator, plus a "long dot" form which allows you to insert optional 
whitespace between dots:
 
-&foo.   ($arg1, $arg2);
+&foo.   .($arg1, $arg2);
+&foo...  #comment
+.($arg1, $arg2);
 
 =item *
 
@@ -1337,20 +1349,21 @@
 (Unlike in Perl 5, where version numbers didn't autoquote.)
 
 You can also use the :key($value) form to quote the keys of option
-pairs.  To align values of option pairs, you may not use the
-dot postfix forms:
+pairs.  To align values of option pairs, you may use the
+"long dot" postfix forms:
 
-:longkey.  ($value)
-:shortkey. 
-:fookey.   { $^a <=> $^b }
+:longkey.  .($value)
+:shortkey. .
+:fookey.   .{ $^a <=> $^b }
 
 These will be interpreted as
 
-:longkey(1).  ($value)
-:shortkey(1). 
-:fookey(1).   { $^a <=> $^b }
+:longkey($value)
+:shortkey
+:fookey{ $^a <=> $^b }
 
-You just have to put spaces inside the parenthesis form to align things.
+But note that C<..> is not a long dot because at least one internal space
+is required to differentiate from the range operator.
 
 =item *
 


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

2006-04-07 Thread larry
Author: larry
Date: Fri Apr  7 19:15:01 2006
New Revision: 8610

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

Log:
Embedded comments are much more generally useful than long dots, especially
when formatted to look good as a pseudo .method call.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Apr  7 19:15:01 2006
@@ -53,6 +53,62 @@
 
 =item *
 
+Single-line comments work as in Perl 5, starting with a C<#> character
+and ending at the subsequent newline.  They count as whitespace
+equivalent to newline for purposes of separation.  Certain quoting
+tokens may make use of C<#> characters as delimiters without starting
+a comment.
+
+=item *
+
+Multiline comments are provided by extending the syntax of POD
+to nest C<=begin comment>/C<=end comment> correctly without the need
+for C<=cut>.  (Doesn't have to be "comment"--any unrecognized POD
+stream will do to make it a comment.  Bare C<=begin> and C<=end>
+probably aren't good enough though, unless you want all your comments
+to end up in the manpage...)
+
+We have single paragraph comments with C<=for comment> as well.
+That lets C<=for> keep its meaning as the equivalent of a C<=begin>
+and C<=end> combined.  As with C<=begin> and C<=end>, a comment started
+in code reverts to code afterwards.
+
+Since there is a newline before the first C<=>, the POD form of comment
+counts as whitespace equivalent to a newline.
+
+=item *
+
+Embedded comments are supported as a variant on quoting syntax, introduced
+by C<.#> and delimited by user-selected characters.
+
+say .#( embedded comment ) "hello, world!";
+
+$object.#/ embedded comments /.say;
+
+$object.#[
+   embedded comments
+].say;
+
+The delimiters of the C<.#//> embedded comment form may be chosen
+from the same set that are valid for ordinary C quote forms,
+and follow the same policy on the nesting of bracketing characters.
+Unlike the other two forms of comment, the embedded form does not
+count as whitespace.
+
+As a variant of the embedded form, a single dot followed by a space
+is equivalent to C<.#.> (plus an extra dot at the end) so you can
+write a small (generally whitespace only) comment as:
+
+%hash.  .{$key}
+@array. .{$key}
+
+which is useful for lining up postfixes.  This is known as the "long dot",
+partly because it substitutes for a dot without the need for a third dot:
+
+$object.  .say();
+
+=item *
+
 In general, whitespace is optional in Perl 6 except where it is needed
 to separate constructs that would be misconstrued as a single token or
 other syntactic unit.  (In other words, Perl 6 follows the standard
@@ -68,13 +124,9 @@
 may occur after a term.  If a given token may be interpreted as
 either a postfix operator or an infix operator, the infix operator
 requires space before it.  Postfix operators may never have intervening
-space, though they may have an intervening dot, or a "long dot" that begins
-and ends with dots and contains whitespace and commentary between the dots.
-The pattern for "long dot" is C<< m:p/\.+ \s \./ >>.  (A minor
-consequence of this is that the C<< postfix:<...> >> operator should not
-be followed by whitespace.  Also, if you put space after the C<..> range
-operator, it should have space before it as well.  But you already do it
-that way, right?)
+space, though they may have an intervening dot.  If further separation
+is desired, an embedded comment may be used as described above, as long
+as no whitespace occurs outside the embedded comment.
 
 For instance, if you were to add your own C<< infix:<++> >> operator,
 then it must have space before it. The normal autoincrementing
@@ -87,64 +139,39 @@
 
 $x. .++
 
-$x... .++
+$x.#..++
 
-$x.. .++
+$x. comment .++
 
-$x...
-.++
+$x.#( comment ).++
 
-$x...  # comment
-   # more comment
+$x.
 .++
 
-$x...  # comment
-=begin podstuff
-whatever
-=end podstuff
+$x.#.
 .++
 
-A consequence of this rule is that, in the absence of a "long dot",
-a dot with whitespace in front of it is always considered a method
-call on C<$_> where a term is expected.  If a term is not expected
-at this point, it is a syntax error.  (Unless, of course, there is
-an infix operator of that name beginning with dot.  You could define
-a Fortranly C<< infix:<.EQ.> >>, for instance, if the fit took you.
-But you'll have to be sure to always put whitespace in front of it, or
-it would be interpreted as a postfix method call instead.)
-
-The long dot form of the C<..

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

2006-04-10 Thread larry
Author: larry
Date: Mon Apr 10 11:04:44 2006
New Revision: 8625

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

Log:
Refactored long dot and embedded comments to be more orthogonal, so that
foo.#{ bar }.baz is now just a long dot whose  happens to match #{}.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 10 11:04:44 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 7 Apr 2006
+  Last Modified: 10 Apr 2006
   Number: 2
-  Version: 21
+  Version: 22
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -44,6 +44,7 @@
 not to use thin spaces where they will make adjoining tokens look like
 a single token.  On the other hand, Perl doesn't use indentation as syntax,
 so you are free to use any whitespace anywhere that whitespace makes sense.
+Comments always count as whitespace.
 
 =back
 
@@ -79,34 +80,50 @@
 =item *
 
 Embedded comments are supported as a variant on quoting syntax, introduced
-by C<.#> and delimited by user-selected characters.
+by C<#> plus any user-selected bracketing characters (including Unicode):
 
-say .#( embedded comment ) "hello, world!";
+say #( embedded comment ) "hello, world!";
 
-$object.#/ embedded comments /.say;
+$object.#{ embedded comments }.say;
 
-$object.#[
+$object.#「
embedded comments
-].say;
+」.say;
 
-The delimiters of the C<.#//> embedded comment form may be chosen
-from the same set that are valid for ordinary C quote forms,
-and follow the same policy on the nesting of bracketing characters.
-Unlike the other two forms of comment, the embedded form does not
-count as whitespace.
-
-As a variant of the embedded form, a single dot followed by a space
-is equivalent to C<.#.> (plus an extra dot at the end) so you can
-write a small (generally whitespace only) comment as:
+There must be no space between the # and the opening bracket character.
+Brackets may be nested following the same policy as ordinary quote brackets.
+
+=item *
+
+In addition to the general comment forms above, there is a whitespace-only
+comment form that begins and ends with a single dot, separated by whitespace,
+which is equivalent to a single dot:
 
 %hash.  .{$key}
 @array. .{$key}
 
-which is useful for lining up postfixes.  This is known as the "long dot",
+This is useful for lining up postfixes.  This is known as the "long dot",
 partly because it substitutes for a dot without the need for a third dot:
 
 $object.  .say();
 
+The whitespace in the middle may include any of the comment forms above.
+Because comments always count as whitespace, the dots in
+
+$object.#{ foo }.say
+
+reduce to a "long dot" rather than the range operator.  Valid ways to
+insert a line break into a sequence of methods calls include:
+
+$object. # comment
+.say
+
+$object.#[ comment
+].say
+
+$object.
+.say
+
 =item *
 
 In general, whitespace is optional in Perl 6 except where it is needed
@@ -139,21 +156,18 @@
 
 $x. .++
 
-$x.#..++
-
-$x. comment .++
-
 $x.#( comment ).++
 
 $x.
 .++
 
-$x.#.
+$x.# comment
+   # more comment
 .++
 
-$x.#[  # comment
-   # more comment
-].++
+$x.#『  comment
+   more comment
+』.++
 
 $x.#[   comment 1
 comment 2
@@ -164,14 +178,38 @@
 ].++
 
 A consequence of the postfix rule is that (except when delimiting a
-a quote or comment) a dot with whitespace in front of it is always
-considered a method call on C<$_> where a term is expected.  If a
-term is not expected at this point, it is a syntax error.  (Unless,
-of course, there is an infix operator of that name beginning with
-dot.  You could, for instance, define a Fortranly C<< infix:<.EQ.> >>
-if the fit took you.  But you'll have to be sure to always put
-whitespace in front of it, or it would be interpreted as a postfix
-method call instead.)
+a quote or terminating a "long dot") a dot with whitespace in front
+of it is always considered a method call on C<$_> where a term is
+expected.  If a term is not expected at this point, it is a syntax
+error.  (Unless, of course, there is an infix operator of that name
+beginning with dot.  You could, for instance, define a Fortranly C<<
+infix:<.EQ.> >> if the fit took you.  But you'll have to be sure to
+always put whitespace in front of it, or it would be interpreted as
+a postfix method call instead.)
+
+For example,
+
+foo .method
+
+and
+
+foo
+.method
+
+will always be interpreted as
+
+foo $_.meth

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

2006-04-10 Thread larry
Author: larry
Date: Mon Apr 10 13:22:51 2006
New Revision: 8631

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

Log:
Clarifications suggested by Nick++ and Daniel++.
Also pilfered the q[[[ ... ]]] multibracket mechanism from pod.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 10 13:22:51 2006
@@ -46,6 +46,15 @@
 so you are free to use any whitespace anywhere that whitespace makes sense.
 Comments always count as whitespace.
 
+=item *
+
+For some syntactic purposes, Perl distinguishes bracketing characters
+from non-bracketing.  Bracketing characters are defined as any Unicode
+characters with either bidirectional mirrorings or Ps/Pe properties.
+(In practice, though, you're safest using matching characters with
+Ps/Pe properties, though ASCII angle brackets are a notable exception,
+since they're bidirectional but not in the Ps/Pe set.)
+
 =back
 
 =head1 Molecules
@@ -80,7 +89,7 @@
 =item *
 
 Embedded comments are supported as a variant on quoting syntax, introduced
-by C<#> plus any user-selected bracketing characters (including Unicode):
+by C<#> plus any user-selected bracket characters (see definition above):
 
 say #( embedded comment ) "hello, world!";
 
@@ -91,7 +100,27 @@
 」.say;
 
 There must be no space between the # and the opening bracket character.
-Brackets may be nested following the same policy as ordinary quote brackets.
+(There may be the I of space for some double-wide
+characters, however, such as the corner quotes above.)  Brackets may
+be nested following the same policy as ordinary quote brackets.
+
+=item *
+
+For all quoting constructs that use user-selected brackets, multiple,
+adjacent, identical opening brackets must always be matched by
+an equal number of adjacent closing brackets.  Use of two or more
+brackets disables bracket counting within the quoted text and merely
+scans for the closing set of brackets.  Hence this comment legally
+contains unmatched brackets and even an unmatched C<{{>:
+
+#{{
+   Comment contains unmatched { and { { { { and {{ and } and } } but not:
+}}
+
+Note however that bare circumfix or postcircumfix C<<< <<...>> >>> is
+not a user-selected bracket, but the ASCII variant of the C<< «...» >>
+interpolating word list.  Only C<#> and the C-style quoters (including
+C, C, C, and C) enable subsequent user-selected brackets.
 
 =item *
 
@@ -113,7 +142,7 @@
 $object.#{ foo }.say
 
 reduce to a "long dot" rather than the range operator.  Valid ways to
-insert a line break into a sequence of methods calls include:
+insert a line break into a sequence of method calls include:
 
 $object. # comment
 .say
@@ -157,6 +186,7 @@
 $x. .++
 
 $x.#( comment ).++
+$x.#((( comment ))).++
 
 $x.
 .++
@@ -178,7 +208,7 @@
 ].++
 
 A consequence of the postfix rule is that (except when delimiting a
-a quote or terminating a "long dot") a dot with whitespace in front
+quote or terminating a "long dot") a dot with whitespace in front
 of it is always considered a method call on C<$_> where a term is
 expected.  If a term is not expected at this point, it is a syntax
 error.  (Unless, of course, there is an infix operator of that name
@@ -547,7 +577,7 @@
 
 Whitespace is not allowed before the parens, but there is a
 corresponding C<.()> operator, plus the "long dot" forms that allow
-you to insert optional whitespace and commentsbetween dots:
+you to insert optional whitespace and comments between dots:
 
 &foo.   .($arg1, $arg2);
 &foo.#[


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

2006-04-10 Thread larry
Author: larry
Date: Mon Apr 10 19:21:56 2006
New Revision: 8637

Modified:
   doc/trunk/design/syn/S04.pod

Log:
Bare block executes immediately; return of closure must be explicit.


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon Apr 10 19:21:56 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 6 Apr 2006
+  Last Modified: 10 Apr 2006
   Number: 4
-  Version: 13
+  Version: 14
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -287,6 +287,10 @@
 useful for the do-once block, since it is offically a loop and can take
 therefore loop control statements.
 
+Although a bare block is no longer a do-once loop, it still executes
+immediately as in Perl 5.  If you wish to return a closure from a
+function, you must use an explicit C.
+
 =head1 Switch statements
 
 A switch statement is a means of topicalizing, so the switch keyword


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

2006-04-10 Thread larry
Author: larry
Date: Mon Apr 10 19:34:44 2006
New Revision: 8638

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

Log:
Force # on the left margin to be line-end comment regardless of brackets.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 10 19:34:44 2006
@@ -104,6 +104,11 @@
 characters, however, such as the corner quotes above.)  Brackets may
 be nested following the same policy as ordinary quote brackets.
 
+As a special case to facilitate commenting out sections of code with
+C, C<#> on the left margin is always considered a line-end
+comment rather than an embedded comment, even if followed by a
+bracketing character.
+
 =item *
 
 For all quoting constructs that use user-selected brackets, multiple,


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

2006-04-10 Thread larry
Author: larry
Date: Mon Apr 10 20:41:31 2006
New Revision: 8641

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

Log:
Revised q<< <> >> to do bracket counting of long brackets internally.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 10 20:41:31 2006
@@ -112,15 +112,13 @@
 =item *
 
 For all quoting constructs that use user-selected brackets, multiple,
-adjacent, identical opening brackets must always be matched by
-an equal number of adjacent closing brackets.  Use of two or more
-brackets disables bracket counting within the quoted text and merely
-scans for the closing set of brackets.  Hence this comment legally
-contains unmatched brackets and even an unmatched C<{{>:
-
-#{{
-   Comment contains unmatched { and { { { { and {{ and } and } } but not:
-}}
+adjacent, identical opening brackets must always be matched by an
+equal number of adjacent closing brackets.  Bracket counting naturally
+applies only to sets of brackets of the same length:
+
+say #{{
+   Comment contains unmatched } and { { { { plus a counted {{ ... }} pair.
+}} q<< <> >>   # says "<>"
 
 Note however that bare circumfix or postcircumfix C<<< <<...>> >>> is
 not a user-selected bracket, but the ASCII variant of the C<< «...» >>


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

2006-04-11 Thread larry
Author: larry
Date: Mon Apr 10 21:39:58 2006
New Revision: 8645

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

Log:
Outlawed 42. (but inlawed .42)


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 10 21:39:58 2006
@@ -215,8 +215,8 @@
 of it is always considered a method call on C<$_> where a term is
 expected.  If a term is not expected at this point, it is a syntax
 error.  (Unless, of course, there is an infix operator of that name
-beginning with dot.  You could, for instance, define a Fortranly C<<
-infix:<.EQ.> >> if the fit took you.  But you'll have to be sure to
+beginning with dot.  You could, for instance, define a Fortranly
+C<< infix:<.EQ.> >> if the fit took you.  But you'll have to be sure to
 always put whitespace in front of it, or it would be interpreted as
 a postfix method call instead.)
 
@@ -244,6 +244,15 @@
 
 if you mean the postfix method call.
 
+One consequence of all this is that you may no longer write a Num as
+C<42.> with just a trailing dot.  You must instead say either C<42>
+or C<42.0>.  In other words, a dot following a number can only be a
+decimal point if the following character is a digit.  Otherwise the
+postfix dot will be taken to be the start of some kind of method call
+syntax, whether long-dotty or not.  (The C<.123> form with a leading
+dot is still allowed however when a term is expected, and is equivalent
+to C<0.123>.)
+
 =back
 
 =head1 Built-In Data Types


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

2006-04-15 Thread larry
Author: larry
Date: Sat Apr 15 11:25:52 2006
New Revision: 8699

Modified:
   doc/trunk/design/syn/S04.pod

Log:
Updated statement-level block syntax to favor statement block over arg block.
(Must use old-fashioned parens around conditional or args otherwise.)


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podSat Apr 15 11:25:52 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 10 Apr 2006
+  Last Modified: 15 Apr 2006
   Number: 4
-  Version: 14
+  Version: 15
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -60,10 +60,27 @@
 my $x = $x;
 
 will no longer see the value of the outer C<$x>; you'll need to say
+either
 
 my $x = $OUTER::x;
 
-instead.  (It's illegal to declare C<$x> twice in the same scope.)
+or
+
+my $x = OUTER::<$x>;
+
+instead.
+
+If you declare a lexical twice in the same scope, it is the same lexical:
+
+my $x;
+my $x;
+
+If you've referred to C<$x> prior to the first declaration, and the compiler
+tentatively bound it to C<$OUTER::x>, then it's an error to declare it, and
+the compiler is allowed to complain at that point.  If such use can't
+be detected because it is hidden in an eval, then it is erroneous, since
+the C compiler might bind to either C<$OUTER::x> or the subsequently
+declared "C".
 
 As in Perl 5, "C" introduces a lexically scoped alias for
 a variable in the current package.
@@ -143,10 +160,8 @@
...
 }
 
-Conditional statement modifiers also work as in Perl 5.  So do the
-implicit conditionals implied by short-circuit operators.  And there's
-a new C in Perl 6--except that you have to spell it C.
-C<:-)>
+Conditional statement modifiers work as in Perl 5.  So do the
+implicit conditionals implied by short-circuit operators.
 
 =head1 Loop statements
 
@@ -289,7 +304,10 @@
 
 Although a bare block is no longer a do-once loop, it still executes
 immediately as in Perl 5.  If you wish to return a closure from a
-function, you must use an explicit C.
+function, you must use an explicit prefix such as C or C
+or C<< -> >>.  (Use of a placeholder parameter is deemed insufficiently
+explicit because it's not out front where it can be seen.  You can, of
+course, use a placeholder parameter if you also use C.)
 
 =head1 Switch statements
 
@@ -592,8 +610,8 @@
 parentheses aren't necessary around C because the whitespace
 between C and the block forces the block to be considered a
 block rather than a subscript.  This works for all control structures,
-not just the new ones in Perl 6.  A bare block where an operator
-is expected is always considered a statement block if there's space
+not just the new ones in Perl 6.  A top-level bare block
+is always considered a statement block if there's space
 before it:
 
 if $foo { ... }
@@ -602,11 +620,31 @@
 while $more { ... }
 for 1..10 { ... }
 
-(You can still parenthesize the expression argument for old times' sake,
-as long as there's a space between the closing paren and the opening
-brace.)
+You can still parenthesize the expression argument for old times'
+sake, as long as there's a space between the closing paren and the
+opening brace.  You I parenthesize the expression if there is
+a bare block that would be misinterpreted as the statement's block.
+This is regardless of whether a term or operator is expected where
+the bare block occurs.  (A block inside brackets, or used as as
+postcircumfix is fine, though.)  Any block with whitespace
+in front of it will be taken as terminating the conditional, even if
+the conditional expression could take another argument.  Therefore
+
+if -e { say "exists" } { extra() }
+
+is always parsed as
+
+if (-e) { say "exists" }; { extra() }
+
+rather than
+
+if (-e { say "exists" }) { extra() }
+
+Apart from that, it is illegal to use a bare closure where an
+operator is expected.  (Remove the whitespace if you wish it to be
+a postcircumfix.)
 
-On the other hand, anywhere a term is expected, a block is taken to
+Anywhere a term is expected, a block is taken to
 be a closure definition (an anonymous subroutine).  If the closure
 appears to delimit nothing but a comma-separated list starting with
 a pair (counting a single pair as a list of one element), the closure
@@ -627,29 +665,32 @@
 $hashref = hash("a", 1);
 
 If a closure is the right argument of the dot operator, the closure
-is interpreted as a hash subscript, even if there is space before the dot.
+is interpreted as a hash subscript.
 
 $ref = {$x};   # closure because term expected
-if $term{$x}

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

2006-04-15 Thread larry
Author: larry
Date: Sat Apr 15 18:38:36 2006
New Revision: 8700

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

Log:
Cleanup typos.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Apr 15 18:38:36 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 10 Apr 2006
+  Last Modified: 15 Apr 2006
   Number: 2
-  Version: 22
+  Version: 23
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -533,9 +533,9 @@
 positional, named, and so on.
 
 Like C objects, C objects are immutable in the abstract, but
-evaluates its arguments lazily.  Before everything inside a C are
+evaluate their arguments lazily.  Before everything inside a C is
 fully evaluated (which happens at compile time when all the arguments are
-constants), the eventual value may well be unknown.  All we know is that is
+constants), the eventual value may well be unknown.  All we know is
 that we have the promise to make the bits of it immutable as they become known.
 
 C objects may contain multiple unresolved iterators such as pipes

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Apr 15 18:38:36 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 6 Apr 2006
+  Last Modified: 15 Apr 2006
   Number: 6
-  Version: 23
+  Version: 24
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -579,7 +579,7 @@
 so that you can use more descriptive internal parameter names without
 imposing inconveniently long external labels on named arguments.
 
-Capture that correspond to named parameters are evaluated in scalar
+Arguments that correspond to named parameters are evaluated in scalar
 context. They can only be passed by name, so it doesn't matter what
 order you pass them in, so long as they don't intermingle with any
 positional arguments:


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

2006-04-18 Thread larry
Author: larry
Date: Tue Apr 18 18:09:20 2006
New Revision: 8874

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

Log:
Clarifications on the relationship of Capture objects to references.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue Apr 18 18:09:20 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 15 Apr 2006
+  Last Modified: 18 Apr 2006
   Number: 2
-  Version: 23
+  Version: 24
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -558,6 +558,13 @@
 parentheses.  The C<$()>, C<@()> and C<%()> forms defaults to C<$/> as the
 implicit argument.
 
+C objects fill the ecological niche of references in Perl 6.
+You can think of them as "fat" references, that is, references that
+can capture not only the current identity of a single object, but
+also the relative identities of several related objects.  Conversely,
+you can think of Perl 5 references as a degenerate form of C
+when you want to refer only to a single item.
+
 =item *
 
 A signature object (C) may be created with coloned parens:
@@ -1429,13 +1436,13 @@
 
 =item *
 
-There's also no
-"C" because symbolic dereferences are now syntactically
-distinguished from hard dereferences.  C<@{$arrayref}> must now be a
-hard reference, while C<@::($string)> is explicitly a symbolic reference.
-(Yes, this may give fits to the P5-to-P6 translator, but I think it's
-worth it to separate the concepts.  Perhaps the symbolic ref form will
-admit hard refs in a pinch.)
+There's also no "C" because symbolic dereferences
+are now syntactically distinguished from hard dereferences.
+C<@($arrayref)> must now provide an actual array object, while
+C<@::($string)> is explicitly a symbolic reference.  (Yes, this may
+give fits to the P5-to-P6 translator, but I think it's worth it to
+separate the concepts.  Perhaps the symbolic ref form will admit real
+objects in a pinch.)
 
 =item *
 


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

2006-04-20 Thread larry
Author: larry
Date: Thu Apr 20 02:07:51 2006
New Revision: 8883

Modified:
   doc/trunk/design/syn/S05.pod

Log:
Various clarifications.
Documented that null first alternative is ignored.
Removed colon separator after last modifier, now just use space.
Deleted the :once modifier.  (A state variable suffices.)
A match object in boolean context isn't always forced to be eager.
Added :ratchet and :panic modifiers to limit backtracking in the parser.
Clarified when rules are allowed vs enforced in variable usage.
Added <%a|%b|%c> form for simple longest-token scoping.
Clarified that hash matches skip over key before value is matched.
Documented behavior of $.
Added *+ ++ ?+ and :+ to force greed on specific atom.
Added token and parse rule variants for grammar productions.
Added <<<...>>> syntax.


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podThu Apr 20 02:07:51 2006
@@ -11,11 +11,11 @@
 
 =head1 VERSION
 
-   Maintainer: Patrick Michaud <[EMAIL PROTECTED]>
+   Maintainer: Patrick Michaud <[EMAIL PROTECTED]> (& TimToady)
Date: 24 Jun 2002
-   Last Modified: 6 Apr 2006
+   Last Modified: 20 Apr 2006
Number: 5
-   Version: 15
+   Version: 16
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them "rules" because they haven't been
@@ -30,8 +30,8 @@
 it doesn't look like it.  The individual capture variables (such as C<$0>,
 C<$1>, etc.) are just elements of C<$/>.
 
-By the way, the numbered capture variables now start at C<$0>, C<$1>,
-C<$2>, etc. See below.
+By the way, the numbered capture variables now start at C<$0> rather than
+C<$1>.  See below.
 
 =head1 Unchanged syntactic features
 
@@ -68,6 +68,8 @@
 =item *
 
 The extended syntax (C) is no longer required...it's the default.
+(In fact, it's pretty much mandatory--the only way to get back to
+the old syntax is with the C<:Perl5>/C<:P5> modifier.)
 
 =item *
 
@@ -78,7 +80,11 @@
 
 There is no C evaluation modifier on substitutions; instead use:
 
- s/pattern/{ code() }/
+ s/pattern/{ doit() }/
+
+Instead of C say:
+
+ s/pattern/{ eval doit() }/
 
 =item *
 
@@ -87,8 +93,9 @@
  m:g:i/\s* (\w*) \s* ,?/;
 
 Every modifier must start with its own colon.  The delimiter must be
-separated from the final modifier by a colon or whitespace if it would
-be taken as an argument to the preceding modifier.
+separated from the final modifier by whitespace if it would be taken
+as an argument to the preceding modifier (which is true for any
+bracketing character).
 
 =item *
 
@@ -127,19 +134,13 @@
 
 is roughly equivalent to
 
- m:p/.*? pattern/
-
-=item *
-
-The new C<:once> modifier replaces the Perl 5 C syntax:
+ m:p/.*? <( pattern )> /
 
- m:once/ pattern /# only matches first time
+Also note that any rule called as a subrule is implicitly anchored to the
+current position anyway.
 
 =item *
 
-[Note: We're still not sure if :w is ultimately going to work exactly 
-as described below.  But this is how it works for now.]
-
 The new C<:w> (C<:words>) modifier causes whitespace sequences to be
 replaced by C<\s*> or C<\s+> subpattern as defined by the C<<  >> rule.
 
@@ -164,6 +165,9 @@
 C<<  >> can't decide what to do until it sees the data.  It still does
 the right thing.  If not, define your own C<<  >> and C<:w> will use that.
 
+In general you don't need to use C<:w> within grammars because
+the parse rules automatically handle whitespace policy for you.
+
 =item *
 
 New modifiers specify Unicode level:
@@ -177,9 +181,9 @@
 
 =item *
 
-The new C<:perl5> modifier allows Perl 5 regex syntax to be used instead:
+The new C<:Perl5> modifier allows Perl 5 regex syntax to be used instead:
 
- m:perl5/(?mi)^[a-z]{1,2}(?=\s)/
+ m:Perl5/(?mi)^[a-z]{1,2}(?=\s)/
 
 (It does not go so far as to allow you to put your modifiers at
 the end.)
@@ -194,16 +198,16 @@
 If followed by an C, it means repetition.  Use C<:x(4)> for the
 general form.  So
 
- s:4x { () = (\N+) $$}{$0 => $1};
+ s:4x [ () = (\N+) $$] [$0 => $1];
 
 is the same as:
 
- s:x(4) { () = (\N+) $$}{$0 => $1};
+ s:x(4) [ () = (\N+) $$] [$0 => $1];
 
 which is almost the same as:
 
  $_.pos = 0;
- s:c{ () = (\N+) $$}{$0 => $1} for 1..4;
+ s:c [ () = (\N+) $$] [$0 => $1] for 1..4;
 
 except that the string is unchanged unless all four matches are found.
 However, ranges are allowed, so you can say C<:x(1..4)> to change anywhere
@@ -250,10 +254,15 @@
  $str = "abracadabra";
 
  if $str ~~ m:exhaustive/ a (.*) a / {
- @substrings =

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

2006-04-20 Thread larry
Author: larry
Date: Thu Apr 20 17:01:01 2006
New Revision: 8891

Modified:
   doc/trunk/design/syn/S05.pod

Log:
As per Damian++'s suggestion, regex is now base form and rule is specialized.
(Note: subrules are still called subrules, not subregexes.)
The .matches method has been unified with multidimensional capture.
Clarified captures and hash key shortening as discussed with Patrick++
Clarified some ignorecase-ness of interpolations.
Reworded section Daniel++ misliked.
Worked over the spelling some.


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podThu Apr 20 17:01:01 2006
@@ -15,12 +15,12 @@
Date: 24 Jun 2002
Last Modified: 20 Apr 2006
Number: 5
-   Version: 16
+   Version: 17
 
 This document summarizes Apocalypse 5, which is about the new regex
-syntax.  We now try to call them "rules" because they haven't been
-regular expressions for a long time.  (The term "regex" is still
-acceptable.)
+syntax.  We now try to call them "regex" because they haven't been
+regular expressions for a long time.  When referring to their use in
+a grammar, the term "rule" is preferred.
 
 =head1 New match state and capture variables
 
@@ -136,7 +136,7 @@
 
  m:p/.*? <( pattern )> /
 
-Also note that any rule called as a subrule is implicitly anchored to the
+Also note that any regex called as a subrule is implicitly anchored to the
 current position anyway.
 
 =item *
@@ -166,7 +166,7 @@
 the right thing.  If not, define your own C<<  >> and C<:w> will use that.
 
 In general you don't need to use C<:w> within grammars because
-the parse rules automatically handle whitespace policy for you.
+the parser rules automatically handle whitespace policy for you.
 
 =item *
 
@@ -234,7 +234,7 @@
 
 =item *
 
-With the new C<:ov> (C<:overlap>) modifier, the current rule will
+With the new C<:ov> (C<:overlap>) modifier, the current regex will
 match at all possible character positions (including overlapping)
 and return all matches in a list context, or a disjunction of matches
 in a scalar context.  The first match at any position is returned.
@@ -242,12 +242,12 @@
  $str = "abracadabra";
 
  if $str ~~ m:overlap/ a (.*) a / {
- @substrings = $/.matches();# bracadabr cadabr dabr br
+ @substrings = @;();# bracadabr cadabr dabr br
  }
 
 =item *
 
-With the new C<:ex> (C<:exhaustive>) modifier, the current rule will match
+With the new C<:ex> (C<:exhaustive>) modifier, the current regex will match
 every possible way (including overlapping) and return all matches in a list
 context, or a disjunction of matches in a scalar context.
 
@@ -266,7 +266,7 @@
 
 =item *
 
-The new C<:rw> modifier causes this rule to "claim" the current
+The new C<:rw> modifier causes this regex to "claim" the current
 string for modification rather than assuming copy-on-write semantics.
 All the bindings in C<$/> become lvalues into the string, such
 that if you modify, say, C<$1>, the original string is modified in
@@ -277,22 +277,22 @@
 
 =item *
 
-The new C<:keepall> modifier causes this rule and all invoked subrules
+The new C<:keepall> modifier causes this regex and all invoked subrules
 to remember everything, even if the rules themselves don't ask for
 their subrules to be remembered.  This is for forcing a grammar that
 throws away whitespace and comments to keep them instead.
 
 =item *
 
-The new C<:ratchet> modifier causes this rule to not backtrack by default.
+The new C<:ratchet> modifier causes this regex to not backtrack by default.
 (Generally you do not use this modifier directly, since it's implied by
-C and C declarations.)  The effect of this modifier is
+C and C declarations.)  The effect of this modifier is
 to imply a C<:> after every construct that could backtrack, including
 bare C<*>, C<+>, and C quantifiers, as well as alternations.
 
 =item *
 
-The new C<:panic> modifier causes this rule and all invoked subrules
+The new C<:panic> modifier causes this regex and all invoked subrules
 to try to backtrack on any rules that would otherwise default to
 not backtracking because they have C<:ratchet> set.  Never panic
 unless you're desperate and want the pattern matcher to do a lot of
@@ -302,7 +302,7 @@
 =item *
 
 The C<:i>, C<:w>, C<:Perl5>, and Unicode-level modifiers can be
-placed inside the rule (and are lexically scoped):
+placed inside the regex (and are lexically scoped):
 
  m/:w alignment = [:i left|right|cent[er|re]] /
 
@@ -428,7 +428,7 @@
 
 =item *
 
-You can call Perl code as part of a rule match by using a closure.

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

2006-04-21 Thread larry
Author: larry
Date: Fri Apr 21 11:13:21 2006
New Revision: 8900

Modified:
   doc/trunk/design/syn/S05.pod

Log:
Fixed up "state $x ||= /.../" example a little more.


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podFri Apr 21 11:13:21 2006
@@ -1063,12 +1063,17 @@
 
 =item *
 
-The Perl 5 C syntax (I) was rarely used and can be
+The Perl 5 C syntax (I) was rarely used and can be
 now emulated more cleanly with a state variable:
 
-(state $x) ||= / pattern /;# only matches first time
+$result = do { state $x ||= m/ pattern /; }# only matches first time
 
-To reset the pattern, simply say C<$x = 0>.
+To reset the pattern, simply say C<$x = 0>.  Though if you want C<$x> visible
+you'd have to avoid using a block:
+
+$result = state $x ||= m/ pattern /;
+...
+$x = 0;
 
 =back
 


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

2006-04-21 Thread larry
Author: larry
Date: Fri Apr 21 13:27:05 2006
New Revision: 8902

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

Log:
Attempt to straighten out Buf vs Str semantics.
In line with autobox-to-uppercase rule, buf types now autobox to Buf types.
There is no native str type.
Smeared distinction between buffer strings and corresponding compact arrays.
I think Bufs and bufs should be mutable.  Their identity is their location.
Also renamed Tuple to Seq to avoid confusion with relational database jive.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Apr 21 13:27:05 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 18 Apr 2006
+  Last Modified: 21 Apr 2006
   Number: 2
-  Version: 24
+  Version: 25
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -319,6 +319,7 @@
 =item *
 
 C by itself does not automatically call a C constructor.
+It merely installs an undefined C prototype as the object.
 The actual constructor syntax turns out to be C,
 making use of the C<.=> mutator method-call syntax.
 
@@ -339,10 +340,10 @@
 immutable types (e.g. C, C, C, C, C,
 C, C, C, C, C, B, C,
 C), as well as mutable (container) types, such as C,
-C, C, C, C, etc.
+C, C, C, C, C, etc.
 
 Non-object (native) types are lowercase: C, C, C,
-C, C, C.  Native types are primarily intended for
+C, C, C.  Native types are primarily intended for
 declaring compact array storage.  However, Perl will try to make those
 look like their corresponding uppercase types if you treat them that way.
 (In other words, it does autoboxing.  Note, however, that sometimes
@@ -392,10 +393,19 @@
 
 =item *
 
-A C is a Unicode string object.  A C is a stringish view of
-an array of integers, and has no Unicode or character properties without
-explicit conversion to some kind of C.  Typically it's an array of bytes
-serving as a buffer.
+A C is a Unicode string object.  (There is no corresponding
+native C type.)  A C is a stringish view of an array of
+integers, and has no Unicode or character properties without explicit
+conversion to some kind of C.  (A C is the native counterpart.)
+Typically it's an array of bytes serving as a buffer.  Bitwise
+operations on a C treat the entire buffer as a single large
+integer.  Bitwise operations on a C generally fail unless the
+C in question can provide an abstract C interface somehow.
+Coercion to C should generally invalidate the C interface.
+As a generic type C may be instantiated as (or bound to) any
+of C, C, or C (or to any type that provide the
+appropriate C interface), but when used to create a buffer C
+defaults to C.
 
 =back
 
@@ -1554,7 +1564,7 @@
 boolean bit Bit ?
 integer int Int int
 numeric num Num +
-string  str Str ~
+string  buf Str ~
 
 There are also various container contexts that require particular kinds of
 containers.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri Apr 21 13:27:05 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 18 Apr 2006
+  Last Modified: 21 Apr 2006
   Number: 6
-  Version: 25
+  Version: 26
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -717,10 +717,10 @@
 *(x=>1);  # Pair, becomes \(x=>1)
 *{x=>1, y=>2};# Hash, becomes \(x=>1, y=>2)
 
-C (also C, C, etc.) are simply turned into
+C (also C, C, etc.) are simply turned into
 positional arguments:
 
-*(1,2,3); # Tuple, becomes \(1,2,3)
+*(1,2,3); # Seq, becomes \(1,2,3)
 *(1..3);  # Range, becomes \(1,2,3)
 *(1..2, 3);   # List, becomes \(1,2,3)
 *([x=>1, x=>2]);  # List (from an Array), becomes \((x=>1), (x=>2))
@@ -1307,8 +1307,7 @@
 bit single native bit
 int native signed integer
 uintnative unsigned integer (autoboxes to Int)
-buf native bytes (finite sequence of "uint8"s, no Unicode)
-str native string (finite sequence of native integers, no Unicode)
+buf native buffer (finite seq of native ints or uints, no Unicode)
 num native floating point
 complexnative complex number
 boolnative boolean
@@ -1329,7 +1328,6 @@
 
 Bit Perl single bit (allows traits, aliasing, undef, etc.)
 Int Perl integer (allows Inf/NaN, arbitrary precision, etc.)
-Buf Pe

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

2006-04-21 Thread larry
Author: larry
Date: Fri Apr 21 14:54:12 2006
New Revision: 8903

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

Log:
Moved adverb description to S02.
Documented :!foo syntax.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Apr 21 14:54:12 2006
@@ -1148,6 +1148,51 @@
 
 =item *
 
+There is now a generalized adverbial form of Pair notation:
+
+The following table shows the correspondence:
+
+Fat arrow  Adverbial pair
+=  ==
+a => 1 :a
+a => 0 :!a
+a => 0 :a(0)
+a => $x:a($x)
+a => 'foo' :a
+a =>  :a
+a => «$foo @bar»   :a«$foo @bar»
+a => {...} :a{...}
+a => [...] :a[...]
+a => $a:$a
+a => @a:@a
+a => %a:%a
+a => %foo   %foo:
+
+Note that as usual the C<{...}> form can indicate either a closure or a hash
+depending on the contents.
+
+Note also that the C<<  >> form is not a subscript and is therefore
+equivalent not to C<.{'a','b'}> but rather to C<('a','b')>.  Bare C<<  >>
+turns into C<('a')> rather than C<('a',)>.
+
+Two or more adverbs can always be strung together without intervening
+punctuation anywhere a single adverb is acceptible.  When used as named
+arguments, you may put comma between.  See S06.
+
+The negated form (C<$!a>) and the sigiled forms (C<:$a>, C<:@a>,
+C<:%a>) never take an argument and don't care what the next character is.
+They are considered complete.
+
+The other forms of adverb (including the bare C<:a> form) I
+look for an immediate bracketed argument, and will slurp it up.
+If that's not intended, you must use whitespace between the adverb
+and the opening bracket.
+
+Despite not being a subscript, the brackets are parsed as postfix operators,
+and may be separated from their C<:foo> with dot or "long dot".
+
+=item *
+
 Generalized quotes may now take adverbs:
 
 Short   LongMeaning
@@ -1208,13 +1253,13 @@
 For these "q" forms the choice of delimiters has no influence on the
 semantics.  That is, C<''>, C<"">, C<< <> >>, C<«»>, C<``>, C<()>,
 C<[]>, and C<{}> have no special significance when used in place of
-C as delimiters.  There may be whitespace or a colon before the
+C as delimiters.  There may be whitespace before the
 opening delimiter. (Which is mandatory for parens because C is
 a subroutine call and C is an adverb with arguments).  Other
-brackets may also require a colon or space when they would be understood as
+brackets may also require whitespace when they would be understood as
 an argument to an adverb in something like C<< q:z// >>.
 A colon may never be used as the delimiter since it will always be
-taken to mean something else regardless of what's in front of it.
+taken to mean another adverb regardless of what's in front of it.
 
 =item *
 
@@ -1357,6 +1402,10 @@
 
 qq:c(0) "Here are { $two uninterpolated } curlies";
 
+or eqivalently:
+
+qq:!c "Here are { $two uninterpolated } curlies";
+
 Alternately, you can build up capabilities from single quote to tell
 it exactly what you I want to interpolate:
 

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri Apr 21 14:54:12 2006
@@ -588,7 +588,7 @@
 $formal = formalize($title, justify=>'left');
 $formal = formalize($title, :justify, :case);
 
-Named parameters are optional unless marked with C.  Default values for
+Named parameters are optional unless marked with a following C.  Default 
values for
 optional named parameters are defined in the same way as for positional
 parameters, but may depend only on the values of parameters that have
 already been bound.  (Note that binding happens in the call order,
@@ -596,23 +596,8 @@
 have no default.  Named required parameters fail unless an argument pair
 of that name is supplied.
 
-Again, note the use of adverbial pairs in the argument list.  The following
-table shows the correspondence:
-
-Fat arrow  Adverbial pair
-=  ==
-a => 1 :a
-a => 0 :a(0)
-a => $x:a($x)
-a => 'foo' :a
-a =>  :a
-a => «$foo @bar»   :a«$foo @bar»
-a => {...} :a{...}
-a =&g

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

2006-04-21 Thread larry
Author: larry
Date: Fri Apr 21 16:57:00 2006
New Revision: 8904

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

Log:
Cleanups suggested by 'f++
Also renamed @; to @;_ so @;() isn't a special case from other sigils.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Apr 21 16:57:00 2006
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 21 Apr 2006
   Number: 2
-  Version: 25
+  Version: 26
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -400,9 +400,9 @@
 Typically it's an array of bytes serving as a buffer.  Bitwise
 operations on a C treat the entire buffer as a single large
 integer.  Bitwise operations on a C generally fail unless the
-C in question can provide an abstract C interface somehow.
-Coercion to C should generally invalidate the C interface.
-As a generic type C may be instantiated as (or bound to) any
+C in question can provide an abstract C interface somehow.
+Coercion to C should generally invalidate the C interface.
+As a generic type C may be instantiated as (or bound to) any
 of C, C, or C (or to any type that provide the
 appropriate C interface), but when used to create a buffer C
 defaults to C.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri Apr 21 16:57:00 2006
@@ -15,7 +15,7 @@
   Date: 21 Mar 2003
   Last Modified: 21 Apr 2006
   Number: 6
-  Version: 26
+  Version: 27
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -790,7 +790,24 @@
 that is a variadic function, the pipe is received as part of its slurpy list.
 So both of the calls above are equivalent to:
 
-grep { $_ % 2 } @data;
+grep { $_ % 2 }, @data;
+
+Note that all such pipes (and indeed all lazy argument lists) supply
+an implicit promise that the code producing the lists may execute
+in parallel with the code receiving the lists.  (Pipes, hyperops,
+and junctions all have this promise of parallelizability in common,
+but differ in interface.  Code which violates these promises is
+erroneous, and will produce undefined results when parallelized.)
+In particular, a pipeline may not begin and end with the same array.
+(You may, however, assign to an array that is used within a pipeline
+on the right side of the assignment, since list assignment will clear
+and copy as necessary to make it work.)  That is, this doesn't work:
+
+@data <== grep { $_ % 2 } <== @data;
+
+but this does:
+
+@data = grep { $_ % 2 } <== @data;
 
 Leftward pipes are a convenient way of explicitly indicating the typical
 right-to-left flow of data through a chain of operations:
@@ -844,31 +861,6 @@
 Since the pipe iterator is bound into the final variable, the variable
 can be just as lazy as the pipe that is producing the values.
 
-=begin Damian
-
-[DMC: On the other hand, these "push" semantics will break a very common
-  left-to-right processing pattern:
-
-  @data ==> grep { condition } ==> sort ==> @data;
-
-  It will also impose a very subtle distinction between the broken
-  symmetry of:
-
-  @data = sort <== grep { condition } <== @data;
-
-  and (the much more tempting, but almost certainly wrong):
-
-  @data <== sort <== grep { condition } <== @data;
-
-  Seems to me that we might be setting a trap here.
-
-  Could there be a special case that turns off "push" semantics in
-  any piped sequence where the origin is the same variable as the
-  destination???
-]
-
-=end Damian
-
 Because pipes are bound to arrays with "push" semantics, you can have
 a receiver for multiple pipes:
 
@@ -947,15 +939,17 @@
 use C instead:
 
 (0..2; 'a'..'c') ==> my @;tmp;
-for @;tmp.map { say }
+for @;tmp.each { say }
 
 and then you just get 0,'a',1,'b',2,'c'.  This is good for
 
-for @;tmp.map -> $i, $a { say "$i: $a" }
+for @;tmp.each -> $i, $a { say "$i: $a" }
 
 In list context the C<@;foo> notation is really a shorthand for C<[;](@;foo)>.
+In particular, you can use C<@;foo> to interpolate a multidimensional slice
+in an array or hash subscript.
 
-Every lexical scope gets its own implicitly declared C<@;> variable,
+Every lexical scope gets its own implicitly declared C<@;_> variable,
 which is the default receiver.  So instead of using C<@;foo> above
 you can just say
 
@@ -964,9 +958,9 @@
 pidigits() ==> ;
 
 # outputs "(0, 'a', 3)\n"...
-for 

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

2006-04-21 Thread larry
Author: larry
Date: Fri Apr 21 18:01:04 2006
New Revision: 8905

Modified:
   doc/trunk/design/syn/S02.pod
   doc/trunk/design/syn/S05.pod
   doc/trunk/design/syn/S06.pod
   doc/trunk/design/syn/S09.pod

Log:
Decided @; made more sense as a double @@ sigil than a twigil.
Unified @@x with @x so you can say sub foo { @@_ } usefully.
Default pipe receiver is now just @@_/@_.
Various other minor cleanups.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Apr 21 18:01:04 2006
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 21 Apr 2006
   Number: 2
-  Version: 26
+  Version: 27
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -427,6 +427,7 @@
 %   unordered hash (associative array)
 &   code
 ::  package/module/class/role/subset/enum/type
+@@  multislice 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.
@@ -464,7 +465,6 @@
 $=foo   pod variable
 $  match variable, short for $/{'foo'}
 $!foo   explicitly private attribute (mapped to $foo though)
-@;foo   multislice
 
 Most variables with twigils are implicitly declared or assumed to
 be declared in some other scope, and don't need a "my" or "our".
@@ -1402,7 +1402,7 @@
 
 qq:c(0) "Here are { $two uninterpolated } curlies";
 
-or eqivalently:
+or equivalently:
 
 qq:!c "Here are { $two uninterpolated } curlies";
 

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podFri Apr 21 18:01:04 2006
@@ -14,9 +14,9 @@
    Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
Larry Wall <[EMAIL PROTECTED]>
Date: 24 Jun 2002
-   Last Modified: 20 Apr 2006
+   Last Modified: 21 Apr 2006
Number: 5
-   Version: 18
+   Version: 19
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I because they haven't been
@@ -31,8 +31,8 @@
 it doesn't look like it.  The individual capture variables (such as C<$0>,
 C<$1>, etc.) are just elements of C<$/>.
 
-By the way, the numbered capture variables now start at C<$0> rather than
-C<$1>.  See below.
+By the way, unlike in Perl 5, the numbered capture variables now
+start at C<$0> instead of C<$1>.  See below.
 
 =head1 Unchanged syntactic features
 
@@ -243,7 +243,7 @@
  $str = "abracadabra";
 
  if $str ~~ m:overlap/ a (.*) a / {
- @substrings = @;();# bracadabr cadabr dabr br
+ @substrings = @@();# bracadabr cadabr dabr br
  }
 
 =item *
@@ -415,7 +415,7 @@
 =item *
 
 C<(...)> still delimits a capturing group. However the ordering of these
-groups is hierarchical, rather than linear. See L.
+groups is hierarchical rather than linear. See L.
 
 =item *
 
@@ -502,7 +502,7 @@
 
  / \Q$var\E /
 
-However, if C<$var> contains a Regex object, rather attempting to
+However, if C<$var> contains a Regex object, instead of attempting to
 convert it to a string, it is called as a subrule, as if you said
 C<< <$var> >>.  (See assertions below.)  This form does not capture,
 and it fails if C<$var> is tainted.
@@ -642,7 +642,7 @@
 
 A leading C<@> matches like a bare array except that each element is
 treated as a subrule (string or Regex object) rather than as a literal.
-That is, a string is forced to be compiled as a subrule rather than
+That is, a string is forced to be compiled as a subrule instead of being
 matched literally.  (There is no difference for a Regex object.)
 
 By default C<< <@foo> >> is captured into C<< $ >>, but you can
@@ -978,7 +978,7 @@
 =item *
 
 Just as a raw C<{...}> is now always a closure (which may still
-execute immediately in certain contexts and be passed as a reference
+execute immediately in certain contexts and be passed as an object
 in others), so too a raw C is now always a Regex object (which
 may still match immediately in certain contexts and be passed as an
 object in others).
@@ -1025,7 +1025,7 @@
  }
 
 Using C<{...}> or C in the scalar context of the first argument
-causes it to produce a C or C reference, which the switch
+causes it to produce a C or C object, which the switch
 statement then selects upon.
 
 =item *
@@ -1634,8 +1634,7 @@
 
 Because a quantified subpattern returns a list of C objects, the
 corresponding array element for the quantified capture will store a
-ref

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

2006-04-21 Thread larry
Author: larry
Date: Fri Apr 21 19:18:36 2006
New Revision: 8906

Modified:
   doc/trunk/design/syn/S02.pod
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S05.pod
   doc/trunk/design/syn/S06.pod

Log:
Finished rule => regex conversion.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Apr 21 19:18:36 2006
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 21 Apr 2006
   Number: 2
-  Version: 27
+  Version: 28
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -338,7 +338,7 @@
 
 Built-in object types start with an uppercase letter. This includes
 immutable types (e.g. C, C, C, C, C,
-C, C, C, C, C, B, C,
+C, C, C, C, C, B, C,
 C), as well as mutable (container) types, such as C,
 C, C, C, C, C, etc.
 
@@ -1179,7 +1179,7 @@
 punctuation anywhere a single adverb is acceptible.  When used as named
 arguments, you may put comma between.  See S06.
 
-The negated form (C<$!a>) and the sigiled forms (C<:$a>, C<:@a>,
+The negated form (C<:!a>) and the sigiled forms (C<:$a>, C<:@a>,
 C<:%a>) never take an argument and don't care what the next character is.
 They are considered complete.
 
@@ -1267,10 +1267,11 @@
 
 macro quote: (*%adverbs) {...}
 
-Note: macro adverbs are automatically evaluated at macro call
-time if the adverbs are included in the parse.  If the adverbs are
-to affect the parsing of the quoted text of the macro, then the text must
-be parsed by the body of the macro rather than by an C rule.
+Note: macro adverbs are automatically evaluated at macro call time if
+the adverbs are included in the parse.  If an adverb needs to affect
+the parsing of the quoted text of the macro, then an explicit named
+parameter may be passed on as a parameter to the C subrule,
+or used to select which subrule to invoke.
 
 =item *
 
@@ -1457,7 +1458,7 @@
 
 Backslash sequences still interpolate, but there's no longer any C<\v>
 to mean I, whatever that is...  (C<\v> now match vertical
-whitespace in a rule.)
+whitespace in a regex.)
 
 =item *
 
@@ -1822,11 +1823,11 @@
 postfix:<++>$x++
 circumfix:<[ ]> [ @x ]
 postcircumfix:<[ ]> $x[$y] or $x .[$y]
-rule_metachar:<,>   /,/
-rule_backslash:  /\w/ and /\W/
-rule_assertion:<*>  /<*stuff>/
-rule_mod_internal:   m:/ ... :perl5 ... /
-rule_mod_external: m:nth(3)/ ... /
+regex_metachar:<,>  /,/
+regex_backslash: /\w/ and /\W/
+regex_assertion:<*> /<*stuff>/
+regex_mod_internal:  m:/ ... :perl5 ... /
+regex_mod_external:m:nth(3)/ ... /
 trait_verb:has $.tail handles 
 trait_auxiliary: my $x shall conform
 scope_declarator:  has $.x;

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod    (original)
+++ doc/trunk/design/syn/S04.podFri Apr 21 19:18:36 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 15 Apr 2006
+  Last Modified: 21 Apr 2006
   Number: 4
-  Version: 15
+  Version: 17
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -752,13 +752,13 @@
 HashArray hash value slice truth   match if $_{any(@$x)}
 Hashany(list) hash key slice existence match if exists $_{any(list)}
 Hashall(list) hash key slice existence match if exists $_{all(list)}
-HashRule  hash key grepmatch if any($_.keys) ~~ /$x/
+HashRegex hash key grepmatch if any($_.keys) ~~ /$x/
 HashAny   hash entry existence match if exists $_{$x}
 Hash.{Any}hash element truth*  match if $_{Any}
 Hash. hash element truth*  match if $_
 Array   Array arrays are identical match if $_ »~~« $x
 Array   any(list) list intersectionmatch if any(@$_) ~~ any(list)
-Array   Rule  array grep   match if any(@$_) ~~ /$x/
+Array   Regex array grep   match if any(@$_) ~~ /$x/
 Array   Num   array contains numbermatch if any($_) == $x
 Array   Str   array contains stringmatch if any($_) eq $x
 Array   .[number] array element truth* match if $_[number]
@@ -771,7 +771,7 @@
 Any 

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

2006-04-21 Thread larry
Author: larry
Date: Fri Apr 21 22:41:58 2006
New Revision: 8907

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

Log:
Lots of tweaks and clarifications, mostly stuff discussed but not yet codified.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podFri Apr 21 22:41:58 2006
@@ -12,14 +12,14 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 7 Apr 2006
+  Last Modified: 21 Apr 2006
   Number: 3
-  Version: 18
+  Version: 19
 
-=head1 Operator renaming
+=head1 Changes to existing operators
 
 Several operators have been given new names to increase clarity and better
-Huffman-code the language:
+Huffman-code the language, while others have changed precedence.
 
 =over
 
@@ -28,10 +28,12 @@
 =item * The string concatenation C<.> becomes C<~>.  Think of it as
 "stitching" the two ends of its arguments together.
 
-=item * Unary C<~> now imposes a string context on its argument,
-and C<+> imposes a numeric context (as opposed to being a no-op
-in Perl 5).  Along the same lines, C imposes a boolean context,
-and C<*> imposes a list context.
+=item * Unary C<~> now imposes a string context on its argument, and
+C<+> imposes a numeric context (as opposed to being a no-op in Perl 5).
+Along the same lines, C imposes a boolean context, and C<*> imposes
+a list context.   Unary sigils impose the container context implied
+by their sigil.  As with Perl 5, however, C<$$foo[bar]> parses as
+C<$($foo)[bar]>, so you need C<$($foo[bar])> to mean the other way.
 
 =item * Bitwise operators get a data type prefix: C<+>, C<~>, or C.
 For example, C<|> becomes either C<+|> or C<~|> or C, depending on
@@ -42,13 +44,17 @@
 is functionally identical to C.  C differs from C<||> in that
 C always returns a standard boolean value (either 1 or 0), whereas
 C<||> return the actual value of the first of its arguments that is
-true.
+true.  Bitwise string operators may only be applied to Buf types or
+similar compact integer arrays, and treat the entire chunk of memory
+as a single huge integer.
 
 =item * C splits into two operators: C (which concatenates repetitions 
 of a string to produce a single string), and C (which creates a list of 
-repetitions of a list or scalar).
+repetitions of a list or scalar).  Conjecture: the C "infix" operator
+takes no right argument and is equivalent to C.
 
-=item * Trinary C becomes C.
+=item * Trinary C becomes C.  It is a syntax error to use an
+operator in the middle that binds looser in precedence, such as C<=>.
 
 =item * C gets a synonym: C< < ... > >, and an interpolating
 variant, C<«...»>.
@@ -69,6 +75,29 @@
 either end to exclude either the beginning or ending.  There is
 also a corresponding C operator with Perl 5's C<...> semantics.
 
+=item * All comparison operators are unified at the same precedence level.
+See Chained Comparisons below.
+
+=item * The list assignment operator now parses on the right like
+any other list operator, so you don't need parens on the right side of:
+
+@foo = 1,2,3;
+
+You do still need them on the left for
+
+($a,$b,$c) = 1,2,3;
+
+since list assignment operators are of assignment precedence to their left.
+
+=item * The scalar assignment operator still parses as it did before, so
+
+loop ($a = 1, $b = 2; ; $a++, $b++) {...}
+
+still works fine.  The distinction between scalar and list assignment
+is pretty much identical to the way Perl 5 does it.  If there are
+parens around the left side, or if the sigil of the variable is C<@>
+or C<%>, it's a list assignment.  Otherwise it's a scalar assignment.
+
 =back
 
 =head1 New operators
@@ -118,9 +147,8 @@
 compile time with a message directing the user either to use C<~~> or C<~=> 
instead,
 or to put a space between if they really wanted to assign a stringified value.)
 
-=item * "Unary" C<.> calls its single argument (which must be a method, or a
-dereferencer for a hash or array) on C<$_>.  (It's not really a unary operator,
-so we put it in quotes.)
+=item * "Unary" C<.> calls its single argument (which must a postfix operator)
+on C<$_>.  (It's not really a unary operator, so we put it in quotes.)
 
 =item * The C<..> range operator has variants with C<^> on either
 end to indicate exclusion of that endpoint from the range.  It always
@@ -136,19 +164,30 @@
 as well.)
 
 Because C objects are lazy, they do not automatically generate
-a list.  So smart matching against a Range object smartmatches the
-endpoints in the domain of the object being matched, so C<< 1.5 ~~
-1^..^2 >> is true.  (But C<< 2.1 ~~ 1..2

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

2006-04-22 Thread larry
Author: larry
Date: Sat Apr 22 11:24:56 2006
New Revision: 8910

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

Log:
Fixes from Daniel and Markus.
Various clarifications on string positions vs Str and Buf types
Broke down and added the  assertion.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Apr 22 11:24:56 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 21 Apr 2006
+  Last Modified: 22 Apr 2006
   Number: 2
-  Version: 28
+  Version: 29
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -393,8 +393,35 @@
 
 =item *
 
-A C is a Unicode string object.  (There is no corresponding
-native C type.)  A C is a stringish view of an array of
+A C is a Unicode string object.  There is no corresponding native
+C type.  However, since a C object may fill multiple roles,
+we say that a C keeps track of its minimum and maximum Unicode
+abstraction levels, and plays along nicely with the current lexical
+scope's idea of the ideal character, whether that is bytes, codepoints,
+graphemes, or characters in some language.  For all builtin operations,
+all C positions are reported as position objects, not integers.
+These C objects point into a particular string at a particular
+location independent of abstraction level.  The subtraction of two
+C objects gives a C object, which is still not an
+integer, because the string between two positions also has multiple
+integer interpretations depending on the units.  A given C
+may know that it represents 18 bytes, 7 codepoints, and 3 graphemes,
+but it knows this lazily because it actually just hangs onto the two
+C objects.  (It's much like a C object in that respect.)
+
+If you use integers as arguments where position objects are expected,
+it will be assumed that you mean the units of the current lexically
+scoped Unicode abstraction level.  (Which defaults to graphemes.)
+Otherwise you'll need to coerce to the proper units:
+
+substr($string, 42.as(Bytes), 1.as(ArabicChars))
+
+Of course, such a dimensional number will fail if used on a string
+that doesn't provide the appropriate abstraction level.
+
+=item *
+
+A C is a stringish view of an array of
 integers, and has no Unicode or character properties without explicit
 conversion to some kind of C.  (A C is the native counterpart.)
 Typically it's an array of bytes serving as a buffer.  Bitwise
@@ -407,6 +434,17 @@
 appropriate C interface), but when used to create a buffer C
 defaults to C.
 
+Unlike C types, C types prefer to deal with integer string
+positions, and map these directly to the underlying compact array
+as indices.  That is, these are not necessarily byte positions--an
+integer position just counts over the number of underlying positions,
+where one position means one cell of the underlying integer type.
+Builtin string operations on C types return integers and expect
+integers when dealing with positions.  As a limiting case, C is
+just an old-school byte string, and the positions are byte positions.
+Note, though, that if you remap a section of C memory to be
+C, you'll have to multiply all your positions by 4.
+
 =back
 
 =head1 Names and Variables

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Apr 22 11:24:56 2006
@@ -328,7 +328,7 @@
 for operators like C<< < >> that don't return the same type as they
 take, so these kinds of operators overload the single-argument case
 to return something more meaningful.  All the comparison operators
-return a boolean for either 1 or 0 arguments.  Negated operators,
+return a boolean for either 1 or 0 arguments.  Negated operators
 return C, and all the rest return C.
 
 This metaoperator can also be used on the semicolon second-dimension
@@ -496,6 +496,7 @@
 my $foo# ordinary lexically scoped variable
 our $foo   # lexically scoped alias to package variable
 has $foo   # object attribute
+env $foo   # environmental lexical
 state $foo # persistent lexical (cloned with closures)
 constant $foo  # lexically scoped compile-time constant
 
@@ -538,7 +539,7 @@
 
 Note that C and C are I variable declarators, because
 their effects only take place at runtime.  Therefore, they take an ordinary
-lvalue object as their arguments.  See S04 for more details.
+lvalue object as their argument.  See S04 for more details.
 
 There are a number of other declarators that are not variable
 declarators.  These includ

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

2006-04-22 Thread larry
Author: larry
Date: Sat Apr 22 17:21:32 2006
New Revision: 8913

Modified:
   doc/trunk/design/syn/S03.pod
   doc/trunk/design/syn/S05.pod
   doc/trunk/design/syn/S06.pod
   doc/trunk/design/syn/S11.pod

Log:
Killed postfix ... dead.
Generalized "Whatever" from subscripts to any MMD op that accepts Whatever.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Apr 22 17:21:32 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 22 Apr 2006
   Number: 3
-  Version: 20
+  Version: 21
 
 =head1 Changes to existing operators
 
@@ -75,6 +75,11 @@
 even in scalar context.)  The C operator may take a caret on
 either end to exclude either the beginning or ending.  There is
 also a corresponding C operator with Perl 5's C<...> semantics.
+You may say
+
+/foo/ ff *
+
+to indicate a flipflop that never flops once flipped.
 
 =item * All comparison operators are unified at the same precedence level.
 See Chained Comparisons below.
@@ -172,6 +177,23 @@
 1.5 ~~ 1^..^2  # true, equivalent to 1 < 1.5 < 2
 2.1 ~~ 1..2# false, equivalent to 1 <= 2.1 <= 2
 
+If an argumentless C<*> (see the "Whatever" operator below) occurs on
+the right side of a range, it is taken to mean "positive infinity"
+in whatever space the range is operating.  A C<*> on the left means
+"negative infinity" for types that support negative values.  If the
+C<*> occurs on one side but not the other, the type is inferred from
+the other argument.  A star on both sides will match any value that
+supports the Ordered role.
+
+0..*   # 0 .. +Inf
+'a'..* # 'a' .. 'z...
+*..0   # -Inf .. 0
+*..*   # "-Inf .. +Inf", really Ordered
+1.2.3..*   # Any version higher than 1.2.3.
+
+Note: infinite lists are constructed lazily.  And even though C<*..*>
+can't be constructed at all, it's still useful as a selector object.
+
 =item * The unary C<^> operator generates a range from C<0> up to
 one less than its argument.  So C<^4> is short for C<0..^4> or C<0..3>.
 
@@ -185,13 +207,8 @@
 so C<^Moose> is short for C.  It still kinda means "what
 is this thing's domain" in an abstract sort of way.
 
-=item * C<...> where an operator is expected is either a unary postfix
-or an infix operator that takes no right argument.  It constructs a
-semi-infinite (and lazily evaluated) list, starting at the value of
-its single argument.
-
-=item * However, C<...> where a term is expected is the "yada,
-yada, yada" prefix operator, which is used as the body in function
+=item * The C<...> prefix operator is the
+"yada, yada, yada" operator, which is used as the body in function
 prototypes.  It complains bitterly (by calling C) if it is
 ever executed.  Variant C calls C, and C calls C.
 The argument is optional, but if provided, is passed onto the C,
@@ -630,6 +647,41 @@
 
 You may use either of them on a scalar iterator to force it to iterate.
 
+=item * The "Whatever" operator
+
+If the C<*> prefix operator has I argument, it 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[*]  # *not* a zen slice
+
+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 bare 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

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

2006-04-24 Thread larry
Author: larry
Date: Mon Apr 24 00:59:42 2006
New Revision: 8928

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

Log:
Rules for parsing and compiling unrecognized identifiers.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 24 00:59:42 2006
@@ -12,7 +12,7 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 23 Apr 2006
+  Last Modified: 24 Apr 2006
   Number: 2
   Version: 30
 
@@ -1531,7 +1531,67 @@
 always be taken to mean a subroutine or method name.  (Class names
 (and other type names) are predeclared, or prefixed with the C<::>
 type sigil when you're declaring a new one.)  A consequence of this
-is that there's no longer any "C".
+is that there's no longer any "C".  Since the syntax
+for method calls is distinguished from sub calls, it is only unreconized
+sub calls that must be treated specially.
+
+You still must declare your subroutines, but an unrecognized bare
+identifier is provisionally compiled as a subroutine call on that
+assumption that such a declaration will occur by the end of the current
+compilation unit.  If it is not, the compile fails at C time.
+(You are still free to predeclare subroutines explicitly, of course.)
+The postdeclaration may be in any lexical or package scope that
+could have made the declaration visible to the provisional call had the
+declaration occurred before rather than after than the provisional
+call.  This fixup is done only for provisional calls.  If there
+is I real predeclaration visible, it always takes precedence.
+In case of multiple ambiguous postdeclarations, either they must all
+be multis, or a compile-time error is declared and you must predeclare,
+even if one postdeclaration is obviously "closer".  A single
+C predeclaration may make all postdeclared C work fine,
+since that's a run-time dispatch, and all multis are effectively
+visible at the point of the controlling C declaration.
+
+If the unrecogized subname is followed by C<< postcircumfix:<( )> >>, it is
+compiled as a provisional function call of the parenthesized form.
+If it is not, it is compiled as a provisional function call of
+the list operator form, which may or may not have an argument list.
+When in doubt, the attempt is made to parse an argument list.  As with
+any list operator, an immediate postfix operator means there are no
+arguments, whereas anything following whitespace will be interpreted
+as an argument list if possible.  It is illegal for a provisional
+subroutine call to be followed by a colon postfix, since such a colon
+is allowed only on an indirect object or a method call in dot form.
+(It is also allowed on a label when a statement is expected.)
+So for any undeclared identifier "C":
+
+foo.bar# foo().bar -- postfix prevents args
+foo .bar   # foo($_.bar)   -- no postfix starts with whitespace
+foo. .bar  # foo().bar -- long dot, so postfix
+foo++  # foo()++   -- postfix
+foo 1,2,3  # foo(1,2,3)-- args always expected after listop
+foo + 1# foo(+1)   -- term always expected after listop
+foo;   # foo();-- no postfix, but no args either
+foo:   #   label   -- must be label at statement boundary.
+   -- illegal otherwise
+foo: bar:  #   two labels in a row
+.foo:  # $_.foo: 1 -- must be "dot" method with : args
+.foo(1)# $_.foo(1) -- must be "dot" method with () args
+.foo   # $_.foo()  -- must be "dot" method with no args
+.$foo: # $_.$foo: 1-- indirect "dot" method with : args
+foo bar: 1 # bar.foo(1)-- bar must be predecl as class or sub
+   -- foo method call even if declared sub
+foo bar 1  # foo(bar(1))   -- both subject to postdeclaration
+   -- never taken as indirect object
+foo $bar: 1# $bar.foo(1)   -- indirect object even if 
declared sub
+foo bar(): # bar().foo(1)  -- even if foo declared sub
+foo bar baz: 1 # foo(bar baz: 1) -- colon controls "bar", not foo.
+foo (bar baz): 1   # bar(baz()).foo(1) -- colon controls "foo"
+$foo $bar  # illegal   -- two terms in a row
+$foo $bar: # illegal   -- use $bar.$foo for indirection
+(foo bar) baz: 1   # illegal   -- use $baz.$(foo bar) for indirection
+
+Parens are required around any indirect object that would be ambiguous.
 
 =item *
 


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

2006-04-24 Thread larry
Author: larry
Date: Mon Apr 24 08:18:48 2006
New Revision: 8931

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

Log:
A postdeclaration may not change the syntax away from listop parsing rules.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 24 08:18:48 2006
@@ -1552,6 +1552,10 @@
 since that's a run-time dispatch, and all multis are effectively
 visible at the point of the controlling C declaration.
 
+Parsing of a provisional call is always done the same way list operators
+are treated.  If a postdeclaration bends the syntax to be inconsistent
+with that, it is an error of the inconsistent signature variety.
+
 If the unrecogized subname is followed by C<< postcircumfix:<( )> >>, it is
 compiled as a provisional function call of the parenthesized form.
 If it is not, it is compiled as a provisional function call of


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

2006-04-24 Thread larry
Author: larry
Date: Mon Apr 24 11:19:24 2006
New Revision: 8933

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

Log:
Clarification requested by spinclad++.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 24 11:19:24 2006
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 24 Apr 2006
   Number: 2
-  Version: 30
+  Version: 31
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -371,7 +371,7 @@
 system of type declarations.  C automatically supports promotion
 to arbitrary precision, as well as holding C and C values.
 
-(C may support arbitrary-precision floating-point arithmatic, but
+(C may support arbitrary-precision floating-point arithmetic, but
 is not required to unless we can do so portably and efficiently.)
 
 C supports arbitrary precision rational arithmetic.  However,
@@ -1215,7 +1215,7 @@
 turns into C<('a')> rather than C<('a',)>.
 
 Two or more adverbs can always be strung together without intervening
-punctuation anywhere a single adverb is acceptible.  When used as named
+punctuation anywhere a single adverb is acceptable.  When used as named
 arguments, you may put comma between.  See S06.
 
 The negated form (C<:!a>) and the sigiled forms (C<:$a>, C<:@a>,
@@ -1532,7 +1532,7 @@
 (and other type names) are predeclared, or prefixed with the C<::>
 type sigil when you're declaring a new one.)  A consequence of this
 is that there's no longer any "C".  Since the syntax
-for method calls is distinguished from sub calls, it is only unreconized
+for method calls is distinguished from sub calls, it is only unrecognized
 sub calls that must be treated specially.
 
 You still must declare your subroutines, but an unrecognized bare
@@ -1588,14 +1588,25 @@
 foo bar 1  # foo(bar(1))   -- both subject to postdeclaration
-- never taken as indirect object
 foo $bar: 1# $bar.foo(1)   -- indirect object even if 
declared sub
-foo bar(): # bar().foo(1)  -- even if foo declared sub
-foo bar baz: 1 # foo(bar baz: 1) -- colon controls "bar", not foo.
+   -- $bar considered one token
+foo (bar()):   # bar().foo(1)  -- even if foo declared sub
+foo bar(): # illegal   -- bar() is two tokens.
+foo .bar:  # foo(.bar:)-- colon chooses .bar to listopify
+foo bar baz: 1 # foo(baz.bar(1)) -- colon controls "bar", not foo.
 foo (bar baz): 1   # bar(baz()).foo(1) -- colon controls "foo"
 $foo $bar  # illegal   -- two terms in a row
 $foo $bar: # illegal   -- use $bar.$foo for indirection
 (foo bar) baz: 1   # illegal   -- use $baz.$(foo bar) for indirection
 
-Parens are required around any indirect object that would be ambiguous.
+The indirect object colon only ever dominates a simple term, where
+"simple" includes classes and variables and parenthesized expressions,
+but explicitly not method calls, because the colon will bind to a
+trailing method call in preference.  An indirect object that parses
+as more than one token must be placed in parentheses, followed by
+the colon.  In short, only an identifier followed by a simple term
+followed by a postfix colon is C parsed as an indirect object,
+but that form will C be parsed as an indirect object regardless
+of whether the identifier is otherwise declared.
 
 =item *
 


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

2006-04-24 Thread larry
Author: larry
Date: Mon Apr 24 17:55:46 2006
New Revision: 8934

Modified:
   doc/trunk/design/syn/S05.pod

Log:
Random cleanup.


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podMon Apr 24 17:55:46 2006
@@ -14,9 +14,9 @@
Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
    Larry Wall <[EMAIL PROTECTED]>
Date: 24 Jun 2002
-   Last Modified: 22 Apr 2006
+   Last Modified: 24 Apr 2006
Number: 5
-   Version: 22
+   Version: 23
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I because they haven't been
@@ -117,6 +117,11 @@
 location.  (Use C<:p> for that.)  The pattern you supply to C
 has an implicit C<:c> modifier.
 
+The C<:continue> modifier takes an optional argument of type C
+which specifies the point at which to start scanning for a match.
+This should not be used unless you know what you're doing, or just
+happen to like hard-to-debug infinite loops.
+
 =item *
 
 The C<:p> (or C<:pos>) modifier causes the pattern to try to match only at
@@ -140,6 +145,10 @@
 Also note that any regex called as a subrule is implicitly anchored to the
 current position anyway.
 
+The C<:pos> modifier takes an optional argument of type C
+which specifies the point at which to attempt a match.  This should not
+be used lightly.  Put it in the category of a "goto".
+
 =item *
 
 The new C<:w> (C<:words>) modifier causes whitespace sequences to be
@@ -502,7 +511,7 @@
 
  / \Q$var\E /
 
-However, if C<$var> contains a Regex object, instead of attempting to
+However, if C<$var> contains a C object, instead of attempting to
 convert it to a string, it is called as a subrule, as if you said
 C<< <$var> >>.  (See assertions below.)  This form does not capture,
 and it fails if C<$var> is tainted.
@@ -519,7 +528,7 @@
 
 
 As with a scalar variable, each element is matched as a literal
-unless it happens to be a Regex object, in which case it is matched
+unless it happens to be a C object, in which case it is matched
 as a subrule.  As with scalar subrules, a tainted subrule always fails.
 All values pay attention to the current C<:ignorecase> setting.
 
@@ -544,9 +553,10 @@
 
 =item *
 
-If it is a Regex object, it is executed as a subrule, with an initial
-position I the matched key.  As with scalar subrules, a tainted
-subrule always fails, and no capture is attempted.
+If it is a C object, it is executed as a subrule, with an
+initial position I the matched key.  (This is further described
+below under the C<< <%hash> >> notation.)  As with scalar subrules,
+a tainted subrule always fails, and no capture is attempted.
 
 =item *
 
@@ -595,9 +605,11 @@
  /  / # was /(? /# match whitespace by :w policy
-
  /  /# match a space char
 
+ /  /  # match only at a particular StrPos
+# short for 
+
 The C assertion implements lookbehind by reversing the syntax
 tree and looking for things in the opposite order going to the left.
 It is illegal to do lookbehind on a pattern that cannot be reversed.
@@ -621,7 +633,7 @@
 =item *
 
 A leading C<$> indicates an indirect subrule.  The variable must contain
-either a Regex object, or a string to be compiled as the regex.  The
+either a C object, or a string to be compiled as the regex.  The
 string is never matched literally.
 
 By default C<< <$foo> >> is captured into C<< $ >>, but you can
@@ -643,9 +655,9 @@
 =item *
 
 A leading C<@> matches like a bare array except that each element is
-treated as a subrule (string or Regex object) rather than as a literal.
+treated as a subrule (string or C object) rather than as a literal.
 That is, a string is forced to be compiled as a subrule instead of being
-matched literally.  (There is no difference for a Regex object.)
+matched literally.  (There is no difference for a C object.)
 
 By default C<< <@foo> >> is captured into C<< $ >>, but you can
 use the C<< <[EMAIL PROTECTED]> >> form to suppress capture, and you can 
always say
@@ -727,7 +739,7 @@
 =item *
 
 In any case of regex interpolation, if the value already happens to be
-a Regex object, it is not recompiled.  If it is a string, the compiled
+a C object, it is not recompiled.  If it is a string, the compiled
 form is cached with the string so that it is not recompiled next
 time you use it unless the string changes.  (Any external lexical
 variable names must be rebound each time though.)  Subrules may not be
@@ -864,26 +876,7 @@
 The C<\G> sequence is gone.  Use C<:p> instead.  (Note, however,
 that it makes no sense

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

2006-04-24 Thread larry
Author: larry
Date: Mon Apr 24 19:38:40 2006
New Revision: 8935

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

Log:
Clarifications on adverbs.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 24 19:38:40 2006
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 24 Apr 2006
   Number: 2
-  Version: 31
+  Version: 32
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1187,9 +1187,8 @@
 
 =item *
 
-There is now a generalized adverbial form of Pair notation:
-
-The following table shows the correspondence:
+There is now a generalized adverbial form of Pair notation.  The
+following table shows the correspondence to the "fatarrow" notation:
 
 Fat arrow  Adverbial pair
 =  ==
@@ -1215,8 +1214,12 @@
 turns into C<('a')> rather than C<('a',)>.
 
 Two or more adverbs can always be strung together without intervening
-punctuation anywhere a single adverb is acceptable.  When used as named
-arguments, you may put comma between.  See S06.
+punctuation anywhere a single adverb is acceptable.  When used as
+named arguments in an argument list, you may put comma between,
+because they're just ordinary named arguments to the function, and
+a fatarrow pair would work the same.   When modifying an operator
+(that is, when one occurs where an operator is expected), you may
+not put commas between, and the fatarrow form is not allowd.  See S06.
 
 The negated form (C<:!a>) and the sigiled forms (C<:$a>, C<:@a>,
 C<:%a>) never take an argument and don't care what the next character is.
@@ -1224,11 +1227,19 @@
 
 The other forms of adverb (including the bare C<:a> form) I
 look for an immediate bracketed argument, and will slurp it up.
-If that's not intended, you must use whitespace between the adverb
-and the opening bracket.
-
-Despite not being a subscript, the brackets are parsed as postfix operators,
-and may be separated from their C<:foo> with dot or "long dot".
+If that's not intended, you must use whitespace between the adverb and
+the opening bracket.  The syntax of individual adverbs is the same
+everywhere in Perl 6.  There are no exceptions based on whether an
+argument is wanted or not.  Except as noted above, the parser always
+looks for the brackets.  Despite not indicating a true subscript,
+the brackets are similarly parsed as postfix operators.  As postfixes
+the brackets may be separated from their initial C<:foo> with either
+dot or "long dot", but nothing else.
+
+Regardless of syntax, adverbs used as named arguments generally show
+up as optional named parameters to the function in question--even
+if the function is an operator or macro.  The function in question
+neither knows nor cares how weird the original syntax was.
 
 =item *
 


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

2006-04-26 Thread larry
Author: larry
Date: Wed Apr 26 14:41:21 2006
New Revision: 8967

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

Log:
Typos, clarifications.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr 26 14:41:21 2006
@@ -56,7 +56,7 @@
 Ps/Pe properties, though ASCII angle brackets are a notable exception,
 since they're bidirectional but not in the Ps/Pe set.
 
-Characters with no corresponding closing characters does not qualify
+Characters with no corresponding closing character do not qualify
 as opening brackets.  This includes the second section of the BidiMirroring
 data table, as well as C and C.
 

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Apr 26 14:41:21 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 25 Apr 2006
+  Last Modified: 26 Apr 2006
   Number: 3
-  Version: 23
+  Version: 24
 
 =head1 Changes to existing operators
 
@@ -99,9 +99,21 @@
 loop ($a = 1, $b = 2; ; $a++, $b++) {...}
 
 still works fine.  The distinction between scalar and list assignment
-is pretty much identical to the way Perl 5 does it.  If there are
-parens around the left side, or if the sigil of the variable is C<@>
-or C<%>, it's a list assignment.  Otherwise it's a scalar assignment.
+is similar to the way Perl 5 does it.  If there are parens around
+the left side, or if the variable is an array or hash, it's a list
+assignment.  Otherwise it's a scalar assignment.  One difference from
+Perl 5 is that Perl 6 does not attempt to intuit whether an lvalue
+slice is meant to be one element or several, so you must use parens
+in that case.  This is true even if you put something that is obviously
+a list as the subscript:
+
+@x[1,2,3] = 4,5,6; # WRONG
+(@x[1,2,3]) = 4,5,6;   # correct
+
+These parens actually apply list context on both sides:
+
+@x[foo()] = bar(); # foo() and bar() both in scalar context
+(@x[foo()]) = bar();   # foo() and bar() both in list context
 
 =back
 
@@ -719,6 +731,25 @@
 
 $hacker.feed: 'Pizza and cola';
 
+This colon is a separate token.  A colon prefixing an adverb is not
+a separate token.  Therefore, under the longest-token rule,
+
+$hacker.feed:xxx('Pizza and cola');
+
+is tokenized as an adverb applying to the method:
+
+$hacker.feed :xxx('Pizza and cola');
+
+not as an xxx sub in the argument list of .feed:
+
+$hacker.feed: xxx('Pizza and cola');  # wrong
+
+If you want both meanings of colon, you have to put it twice:
+
+$hacker.feed: :xxx('Pizza and cola'), 1,2,3;
+
+(For similar reasons it's best to put whitespace after the colon of a label.)
+
 =head1 C
 
 In order to support parallel iteration over multiple arrays, Perl 6 has
@@ -782,12 +813,12 @@
 method postfix  . .+ .? .* .() .[] .{} .«» .=
 autoincrement   ++ --
 exponentiation  **
-symbolic unary  ! + - ~ ? $ @ % & * ** +^ ~^ ?^ \ ^ = -e -r -w -x etc.
+symbolic unary  ! + - ~ ? $ @ % & * ** +^ ~^ ?^ \ ^ =
 multiplicative  * / % x xx +& +< +> ~& ~< ~>
 additive+ - ~ +| +^ ~| ~^
 junctive and (all)  &
 junctive or (any)   | ^
-named unary rand sleep abs etc.
+named unary rand sleep abs etc. -e -r -w -x etc.
 nonchaining binary  but does cmp <=> .. ^.. ..^ ^..^ ff ^ff ff^ ^ff^ fff 
^fff etc.
 chaining binary != == < <= > >= ~~ !~ eq ne lt le gt ge =:= ===
 tight and   &&


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

2006-04-27 Thread larry
Author: larry
Date: Thu Apr 27 09:33:20 2006
New Revision: 8973

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

Log:
Clarify placeholders are illegal if conflicting with other signature.


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podThu Apr 27 09:33:20 2006
@@ -1286,6 +1286,8 @@
 -> $x,$y,$z { $y < $z && $x != 2 }
 
 Note that placeholder variables syntactically cannot have type constraints.
+Also, it is illegal to use placeholder variables in a block that already
+has a signature, because the autogenerated signature would conflict with that.
 
 =head1 Built-in Types
 


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

2006-04-30 Thread larry
Author: larry
Date: Sun Apr 30 10:43:33 2006
New Revision: 9042

Modified:
   doc/trunk/design/syn/S02.pod
   doc/trunk/design/syn/S03.pod
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S12.pod

Log:
Long dot is now introduced by backslash.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSun Apr 30 10:43:33 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 26 Apr 2006
+  Last Modified: 30 Apr 2006
   Number: 2
-  Version: 34
+  Version: 35
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -141,33 +141,35 @@
 
 =item *
 
-In addition to the general comment forms above, there is a whitespace-only
-comment form that begins and ends with a single dot, separated by whitespace,
+In addition to the general comment forms above, there is a
+whitespace-only comment form that begins with backslash and ends
+with a single dot, separated by 0 or more characters of whitespace,
 which is equivalent to a single dot:
 
-%hash.  .{$key}
-@array. .{$key}
+%hash\  .{$key}
+@array\ .[$ix]
+$subref\.($arg)
 
 This is useful for lining up postfixes.  This is known as the "long dot",
-partly because it substitutes for a dot without the need for a third dot:
+partly because it substitutes for a dot without the need for an extra dot:
 
-$object.  .say();
+$object\  .say();
 
 The whitespace in the middle may include any of the comment forms above.
-Because comments always count as whitespace, the dots in
+Because comments always count as whitespace, the C<\.> in
 
-$object.#{ foo }.say
+$object\#{ foo }.say
 
 reduce to a "long dot" rather than the range operator.  Valid ways to
 insert a line break into a sequence of method calls include:
 
-$object. # comment
+$object\ # comment
 .say
 
-$object.#[ comment
+$object\#[ comment
 ].say
 
-$object.
+$object\
 .say
 
 =item *
@@ -659,8 +661,8 @@
 corresponding C<.()> operator, plus the "long dot" forms that allow
 you to insert optional whitespace and comments between dots:
 
-&foo.   .($arg1, $arg2);
-&foo.#[
+&foo\   .($arg1, $arg2);
+&foo\#[
embedded comment
 ].($arg1, $arg2);
 

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSun Apr 30 10:43:33 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 26 Apr 2006
+  Last Modified: 30 Apr 2006
   Number: 3
-  Version: 24
+  Version: 25
 
 =head1 Changes to existing operators
 
@@ -802,8 +802,8 @@
 I syntax:
 
  %monsters.{'cookie'} = Monster.new;
- %people. .{'john'}   = Person.new;
- %cats.   .{'fluffy'} = Cat.new;
+ %people\ .{'john'}   = Person.new;
+ %cats\   .{'fluffy'} = Cat.new;
 
 =head1 Precedence
 

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podSun Apr 30 10:43:33 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 25 Apr 2006
+  Last Modified: 30 Apr 2006
   Number: 4
-  Version: 18
+  Version: 19
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -674,7 +674,7 @@
 if $term{$x}   # subscript because postfix expected
 if $term {$x}  # expression followed by statement block
 if $term.{$x}  # valid subscript with dot
-if $term. .{$x}# valid subscript with "long dot"
+if $term\ .{$x}# valid subscript with "long dot"
 
 Similar rules apply to array subscripts:
 
@@ -682,7 +682,7 @@
 if $term[$x]   # subscript because postfix expected
 if $term [$x]  # syntax error (two terms in a row)
 if $term.[$x]  # valid subscript with dot
-if $term. .[$x]# valid subscript with "long dot"
+if $term\ .[$x]# valid subscript with "long dot"
 
 And to the parentheses delimiting function arguments:
 
@@ -690,7 +690,7 @@
 if $term($x)   # function call because operator expected
 if $term ($x)  # syntax error (two terms in a row)
 if $term.($x)  # valid function call with dot
-if $term. .($x)# valid function call with "long dot"
+if $term\ .($x)# valid function call with "l

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

2006-04-30 Thread larry
Author: larry
Date: Sun Apr 30 18:51:14 2006
New Revision: 9047

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

Log:
More long dot cleanup from trey++ et al.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSun Apr 30 18:51:14 2006
@@ -107,9 +107,9 @@
 
 say #( embedded comment ) "hello, world!";
 
-$object.#{ embedded comments }.say;
+$object\#{ embedded comments }.say;
 
-$object.#「
+$object\ #「
embedded comments
 」.say;
 
@@ -160,7 +160,7 @@
 
 $object\#{ foo }.say
 
-reduce to a "long dot" rather than the range operator.  Valid ways to
+reduce to a "long dot".  Valid ways to
 insert a line break into a sequence of method calls include:
 
 $object\ # comment
@@ -202,23 +202,23 @@
 
 $x.++
 
-$x. .++
+$x\ .++
 
-$x.#( comment ).++
-$x.#((( comment ))).++
+$x\#( comment ).++
+$x\#((( comment ))).++
 
-$x.
+$x\
 .++
 
-$x.# comment
+$x\# comment
# more comment
 .++
 
-$x.#『  comment
+$x\#『  comment
more comment
 』.++
 
-$x.#[   comment 1
+$x\#[   comment 1
 comment 2
 =begin podstuff
 whatever (pod comments ignore current parser state)
@@ -1368,18 +1368,15 @@
 
 =item 6. A sequence of one or more unparenthesized method call, followed by 
any of 1 through 5
 
-=item 7. An embedded comment that uses bracketing characters, such
-as .#(comment).
-
 =back
 
 In other words, this is legal:
 
-"Val = $a.ord.#( Yikes! ).as('%x')\n"
+"Val = $a.ord.as('%x')\n"
 
 and is equivalent to
 
-"Val = { $a.ord.#( Yikes! ).as('%x') }\n"
+"Val = { $a.ord.as('%x') }\n"
 
 
 =item *


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

2006-04-30 Thread larry
Author: larry
Date: Sun Apr 30 18:55:42 2006
New Revision: 9048

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

Log:
Couple more long dots.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSun Apr 30 18:55:42 2006
@@ -255,7 +255,7 @@
 
 Use some variant of
 
-foo.
+foo\
 .method
 
 if you mean the postfix method call.
@@ -1606,7 +1606,7 @@
 
 foo.bar# foo().bar -- postfix prevents args
 foo .bar   # foo($_.bar)   -- no postfix starts with whitespace
-foo. .bar  # foo().bar -- long dot, so postfix
+foo\ .bar  # foo().bar -- long dot, so postfix
 foo++  # foo()++   -- postfix
 foo 1,2,3  # foo(1,2,3)-- args always expected after listop
 foo + 1# foo(+1)   -- term always expected after listop


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

2006-05-01 Thread larry
Author: larry
Date: Mon May  1 17:13:17 2006
New Revision: 9091

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

Log:
Explained why any has to be different from any .


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podMon May  1 17:13:17 2006
@@ -12,7 +12,7 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 2 May 2006
+  Last Modified: 1 May 2006
   Number: 3
   Version: 26
 
@@ -115,6 +115,61 @@
 @x[foo()] = bar(); # foo() and bar() both in scalar context
 (@x[foo()]) = bar();   # foo() and bar() both in list context
 
+=item * List operators are all parsed consistently.  As in Perl 5,
+to the left they look like terms, while to the right they look like
+operators that are looser than comma.  Unlike in Perl 5, the difference
+between the list operator form and the function form is consistently
+indicated via whitespace between the list operator and the first
+argument.  If there is whitespace, it is always a list operator,
+and the next token will be taken as the first term of the list.
+If there is no whitespace, the parser is biased towards taking the
+next token as an operator if at all possible.  If the next token
+can be taken as either an infix or a postfix operator, it indicates
+that the list operator has no arguments.  (Or more precisely, no
+extra arguments that aren't supplied the operator, since C<.()>
+is a postfix that supplies arguments to the preceding function.)
+
+Examples:
+
+say foo($bar+1),$baz   say(foo($bar+1), $baz);
+say foo.($bar+1),$baz  say(foo($bar+1), $baz);
+say foo ($bar+1),$baz  say(foo($bar+1, $baz));
+say foo .($bar+1),$baz say(foo($_.($bar+1), $baz));
+
+say foo[$bar+1],$baz   say((foo[$bar+1]), $baz);
+say foo.[$bar+1],$baz  say((foo[$bar+1]), $baz);
+say foo [$bar+1],$baz  say(foo([$bar+1], $baz));
+say foo .[$bar+1],$baz say(foo($_.[$bar+1], $baz));
+
+say foo{$bar+1},$baz   say((foo{$bar+1}), $baz);
+say foo.{$bar+1},$baz  say((foo{$bar+1}), $baz);
+say foo {$bar+1},$baz  say(foo({$bar+1}, $baz));
+say foo .{$bar+1},$baz say(foo($_.{$bar+1}, $baz));
+
+say foo<$bar+1>,$baz   say((foo<$bar+1>), $baz);
+say foo.<$bar+1>,$baz  say((foo<$bar+1>), $baz);
+say foo <$bar+1>,$baz  say(foo(<$bar+1>, $baz));
+say foo .<$bar+1>,$baz say(foo($_.<$bar+1>, $baz));
+
+Note that Perl 6 is making a consistent three-way distinction between
+term vs postfix vs infix, and will interpret an overloaded character
+like C<< < >> accordingly:
+
+any any('a','b','c')# term
+any (any).{'a','b','c'} # postfix
+any()   (any).{'a','b','c'} # postfix
+any() < $x (any) < $x  # infix
+
+This will seem unfamiliar and "undwimmy" to Perl 5 programmers, who
+are used to a grammar that sloppily hardwires a few postfix operators
+at the price of extensibility.  Perl 6 chooses instead to mandate a
+whitespace dependency in order to gain a completely extensible class
+of postfix operators.
+
+=item * A list operator's arguments are also terminated by a closure
+that is not followed by a comma or colon.  (And a semicolon is implied if
+the closure is the final thing on a line.)
+
 =back
 
 =head1 New operators


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

2006-05-01 Thread larry
Author: larry
Date: Mon May  1 22:36:54 2006
New Revision: 9096

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

Log:
Refined some notions about how we want to support numerics long term.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon May  1 22:36:54 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 30 Apr 2006
+  Last Modified: 1 May 2006
   Number: 2
-  Version: 35
+  Version: 36
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -388,24 +388,40 @@
 to arbitrary precision, as well as holding C and C values.
 
 (C may support arbitrary-precision floating-point arithmetic, but
-is not required to unless we can do so portably and efficiently.)
+is not required to unless we can do so portably and efficiently.  Num
+must support the largest native floating point format that runs at full speed.)
 
 C supports arbitrary precision rational arithmetic.  However,
 dividing two C objects produces fractionals as C objects by
 default, not C objects.  You can override this behavior with
 a pragma.
 
-Lower-case types like C and C imply the native machine
-representation for integers and floating-point numbers, respectively, and
-do not promote to arbitrary precision.  Untyped numeric scalars use C
-and C semantics rather than C and C.
+Lower-case types like C and C imply the native
+machine representation for integers and floating-point numbers,
+respectively, and do not promote to arbitrary precision, though
+larger representations are always allowed for temporary values.
+Unless qualified with a number of bits, C and C types default
+to the largest native types that run at full speed.  Untyped numeric
+scalars use C and C semantics rather than C and C.
+
 
 =item *
 
 Perl 6 should by default make standard IEEE floating point concepts
-visible, such as C (infinity) and C (not a number).
-It should also be at least pragmatically possible to throw exceptions
-on overflow.
+visible, such as C (infinity) and C (not a number).  Within a
+lexical scope, pragmas may specify the nature of temporary values,
+and how floating point is to behave under various circumstances.
+All IEEE modes must be lexically available via pragma except in cases
+where that would entail heroic efforts to bypass a braindead platform.
+
+The default floating-point modes do not throw exceptions but rather
+propagate Inf and NaN.  The boxed object types may carry more detailed
+information on where overflow or underflow occurred.  Numerics in Perl
+are not designed to give the identical answer everywhere.  They are
+designed to give the typical programmer the tools to achieve a good
+enough answer most of the time.  (Really good programmers may occasionally
+do even better.)  Mostly this just involves using enough bits that the
+stupidities of the algorithm don't matter much.
 
 =item *
 


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

2006-05-02 Thread larry
Author: larry
Date: Tue May  2 13:57:33 2006
New Revision: 9107

Modified:
   doc/trunk/design/syn/S29.pod

Log:
Redirected S29 link to pugs repository.


Modified: doc/trunk/design/syn/S29.pod
==
--- doc/trunk/design/syn/S29.pod(original)
+++ doc/trunk/design/syn/S29.podTue May  2 13:57:33 2006
@@ -10,18 +10,13 @@
 
 =head1 VERSION
 
-  Maintainer: Rod Adams <[EMAIL PROTECTED]>
+  Maintainer: Larry Wall <[EMAIL PROTECTED]>
 
 =head1 Placeholder
 
 This pod is just a placeholder for the draft of Synopsis 29 that
-Rod Adams is currently building and maintaining, until we feel that
-the draft has matured sufficiently to warrant inclusion with the
-other Apocalypses and Synopses.
+currently lives at
 
-Until they appear here, the latest drafts are available at
-
-http://www.rodadams.net/Perl/S29.pod
-http://www.rodadams.net/Perl/S29.html
+http://svn.openfoundry.org/pugs/docs/Perl6/Spec/Functions.pod
 
 


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

2006-05-03 Thread larry
Author: larry
Date: Wed May  3 09:57:42 2006
New Revision: 9110

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

Log:
Clarifications on Capture-ness of returned values.


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podWed May  3 09:57:42 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 25 Apr 2006
+  Last Modified: 3 May 2006
   Number: 6
-  Version: 31
+  Version: 32
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1753,6 +1753,27 @@
 
 return( (:x<1>), (:y<2>) ); # two positional Pair objects
 
+Note that the postfix parentheses on the function call don't count as
+"additional".  However, as with any function, whitespace after the
+C keyword prevents that interpretation and turns it instead
+into a list operator:
+
+return :x<1>, :y<2>; # two named arguments (if caller uses *)
+return ( :x<1>, :y<2> ); # two positional Pair objects
+
+If the function ends with an expression without an explicit C,
+that expression is also taken to be a C, just as if expression
+were the argument to a C list operator (with whitespace):
+
+sub f { :x<1> } # named-argument binding (if caller uses *)
+sub f { (:x<1>) } # always just one positional Pair object 
+
+On the caller's end, the C is interpolated into any new argument list
+much like an array would be, that is, as a scalar in scalar context, and as
+a list in list context.  This is the default behavior, but as with an array,
+the caller may use C<< prefix:<*> >> to inline the returned values as part of
+the new argument list.  The caller may also bind the return Capture directly.
+
 =head2 The C function
 
 The C function returns an object that describes a particular 
@@ -1940,6 +1961,13 @@
 Outside a wrapper, C implicitly calls the next-most-likely method
 or multi-sub; see S12 for details.
 
+As with any return value, you may capture the returned C of call
+by binding:
+
+my \$retval = call(*$args);
+... # postprocessing
+return *$retval;
+
 =head2 The C<&?ROUTINE> object
 
 C<&?ROUTINE> is always an alias for the lexically innermost C


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

2006-05-03 Thread larry
Author: larry
Date: Wed May  3 10:42:06 2006
New Revision: 9111

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

Log:
Typos, clarifications for return, call, and leave.


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podWed May  3 10:42:06 2006
@@ -15,7 +15,7 @@
   Date: 21 Mar 2003
   Last Modified: 3 May 2006
   Number: 6
-  Version: 32
+  Version: 33
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1542,7 +1542,7 @@
 
 my sub wanda ($x) returns Fish { ... }
 
-It is possible for the outer type to disagree with the outside type:
+It is possible for the outer type to disagree with the inner type:
 
 my Squid sub wanda ($x) returns Fish { ... }
 
@@ -1738,6 +1738,14 @@
 
 =head2 The C function
 
+The C function notionally throws a control exception that is caught
+by the current lexically enclosing C to force a return through
+the control logic code of any intermediate block constructs.  With normal
+blocks this can be optimized away to a "goto".  All C declarations
+have an explicit declarator such as C or C; bare blocks and
+"pointy" subs are never considered to be routines in that sense.  To return
+from a block, use C instead--see below.
+
 The C function preserves its argument list as a C object, and
 responds to the left-hand C in a binding.  This allows named return
 values if the caller expects one:
@@ -1762,17 +1770,17 @@
 return ( :x<1>, :y<2> ); # two positional Pair objects
 
 If the function ends with an expression without an explicit C,
-that expression is also taken to be a C, just as if expression
+that expression is also taken to be a C, just as if the expression
 were the argument to a C list operator (with whitespace):
 
 sub f { :x<1> } # named-argument binding (if caller uses *)
 sub f { (:x<1>) } # always just one positional Pair object 
 
 On the caller's end, the C is interpolated into any new argument list
-much like an array would be, that is, as a scalar in scalar context, and as
-a list in list context.  This is the default behavior, but as with an array,
-the caller may use C<< prefix:<*> >> to inline the returned values as part of
-the new argument list.  The caller may also bind the return Capture directly.
+much like an array would be, that is, as a scalar in scalar context, and as a
+list in list context.  This is the default behavior, but as with an array, the
+caller may use C<< prefix:<*> >> to inline the returned values as part of the
+new argument list.  The caller may also bind the returned C directly.
 
 =head2 The C function
 
@@ -1834,7 +1842,7 @@
 leave Method;   # return from innermost calling method
 leave &?SUB <== 1,2,3;  # Return from current sub. Same as: return 
1,2,3
 leave &foo <== 1,2,3;   # Return from innermost surrounding call to 
&foo
-leave Loop, :label;  # Same as: last COUNT;
+leave Loop where { .label eq 'COUNT' };  # Same as: last COUNT;
 
 Note that the last is equivalent to
 
@@ -1844,6 +1852,10 @@
 
 last COUNT <== 42;
 
+If supplied, the first argument to C is a C, and will
+be smart-matched against the dynamic scope objects from inner to outer.
+The first that matches is the scope that is left.
+
 =head2 Temporization
 
 The C function temporarily replaces the value of an existing
@@ -1961,10 +1973,10 @@
 Outside a wrapper, C implicitly calls the next-most-likely method
 or multi-sub; see S12 for details.
 
-As with any return value, you may capture the returned C of call
+As with any return value, you may capture the returned C of C
 by binding:
 
-my \$retval = call(*$args);
+my \$retval := call(*$args);
 ... # postprocessing
 return *$retval;
 


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

2006-05-05 Thread larry
Author: larry
Date: Fri May  5 15:02:52 2006
New Revision: 9119

Modified:
   doc/trunk/design/syn/S04.pod

Log:
Clarified that parens are required on C-style loop.


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podFri May  5 15:02:52 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 30 Apr 2006
+  Last Modified: 5 May 2006
   Number: 4
-  Version: 19
+  Version: 20
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -206,7 +206,8 @@
...
 }
 
-As seen in the previous section, the 3-part loop spec may be entirely
+As in C, the parentheses are required if you supply the 3-part spec; however,
+as shown in the previous section, the 3-part loop spec may be entirely
 omitted to write an infinite loop.  If you omit the 3-part loop spec
 you may add a C or C statement modifier at the end
 to make it a "repeat at least once" loop.  Unlike C in Perl 5,


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

2006-05-05 Thread larry
Author: larry
Date: Fri May  5 15:27:43 2006
New Revision: 9120

Modified:
   doc/trunk/design/syn/S09.pod
   doc/trunk/design/syn/S11.pod

Log:
Typos from Dr.Ruud and Marcus Laire.


Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podFri May  5 15:27:43 2006
@@ -182,7 +182,7 @@
 
 which is equivalent to
 
-@array.postcircumfix:<[ ]>( <== @x[0] <== @x[1] <== @x[2]...);
+@array.postcircumfix:<[ ]>( <== @x[0] <== @x[1] <== @x[2]..*);
 
 Alternately, use a multislice array, indicated by a double C<@@> sigil:
 
@@ -195,7 +195,7 @@
 my @@x;
 @@x <==  %hash.keys.grep: {/^X/};
 @@x <== =<>;
-@@x <== 1...;
+@@x <== 1..*;
 @@x <== gather { loop { take rand 100 } };
 
 %hash{@@x}
@@ -207,7 +207,7 @@
 my @x;
 @x <==  %hash.keys.grep: {/^X/};
 @x <== =<>;
-@x <== 1...;
+@x <== 1..*;
 @x <== gather { loop { take rand 100 } };
 
 %hash{@@x} # multidimensional
@@ -308,7 +308,7 @@
 just like scalars -- the main caveat is that you have to use
 binding rather than assignment to set one without copying:
 
-@b := @a[0...:by(2)]
+@b := @a[0..(*):by(2)]
 
 With PDLs in particular, this might alias each of the individual
 elements rather than the array as a whole.  So modifications to @b
@@ -340,7 +340,7 @@
 semicolon-separated list of slice specifiers, also known as a multislice.
 A three-dimensional slice might look like this:
 
-@x[0..10; 1,0; 1...:by(2)]
+@x[0..10; 1,0; 1..(*):by(2)]
 
 It is up to the implementation of C<@x> to decide how aggressively
 or lazily this subscript is evaluated, and whether the slice entails
@@ -412,9 +412,9 @@
 
 @nums[$min..$max:by(3)]
 @nums[$min..$max]
-@nums[$min...:by(3)]
-@nums[1...:by(2)]  # the odds
-@nums[0...:by(2)]  # the evens
+@nums[$min..(*):by(3)]
+@nums[1..(*):by(2)]# the odds
+@nums[0..(*):by(2)]# the evens
 
 That's all just the standard Perl 6 notation for ranges.  Additional
 syntactic relief is always available as long as it's predeclared
@@ -440,15 +440,7 @@
 
 0 .. Inf :by(2)
 
-That why we have postfix C<...> to mean C<..Inf>.  But then if you
-leave out the first argument:
-
-...:by(2)
-
-you've written the yada-yada-yada operator, which is actually a term
-that will not produce an infinite range for you.  Don't do that.
-
-Maybe you should just find some nice Unicode characters for your operators...
+That's why we have postfix C<..*> to mean C<..Inf>.
 
 =head1 PDL signatures
 
@@ -700,7 +692,7 @@
 C<.keys>, C<.values>, or C<.kv>, it calls C<%hash.iterator()> to
 start one.  In scalar context, C<.iterator> returns an iterator object.
 In list context, it returns a lazy list fed by the iterator.  It must
-be possible for a hash to be in more than one iterator at at time,
+be possible for a hash to be in more than one iterator at a time,
 as long as the iterator state is stored in a lazy list.
 However, there is only one implicit iterator (the C iterator)
 that works in scalar context to return the next pair.  [Or maybe not.]

Modified: doc/trunk/design/syn/S11.pod
==
--- doc/trunk/design/syn/S11.pod(original)
+++ doc/trunk/design/syn/S11.podFri May  5 15:27:43 2006
@@ -342,4 +342,4 @@
 It's not necessary to force Perl 6 if the interpreter or command
 specified already implies it, such as use of a "C<#!/usr/bin/perl6>"
 shebang line.  Nor is it necessary to force Perl 6 in any file that
-beings with the "class" or "module" keywords.
+begins with the "class" or "module" keywords.


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

2006-05-06 Thread larry
Author: larry
Date: Sat May  6 10:04:16 2006
New Revision: 9126

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

Log:
Simplified # to always be comment even where a quote delim is expected.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat May  6 10:04:16 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 2 May 2006
+  Last Modified: 6 May 2006
   Number: 2
-  Version: 37
+  Version: 38
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -79,9 +79,8 @@
 
 Single-line comments work as in Perl 5, starting with a C<#> character
 and ending at the subsequent newline.  They count as whitespace
-equivalent to newline for purposes of separation.  Certain quoting
-tokens may make use of C<#> characters as delimiters without starting
-a comment.
+equivalent to newline for purposes of separation.  Unlike in Perl 5,
+C<#> may not be used as the delimiter in quoting constructs.
 
 =item *
 
@@ -1354,6 +1353,8 @@
 an argument to an adverb in something like C<< q:z// >>.
 A colon may never be used as the delimiter since it will always be
 taken to mean another adverb regardless of what's in front of it.
+Nor may a C<#> character be used as the delimiter since it is always
+taken as whitespace (specifically, as a comment).
 
 =item *
 


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

2006-05-08 Thread larry
Author: larry
Date: Mon May  8 16:50:55 2006
New Revision: 9138

Modified:
   doc/trunk/design/syn/S12.pod

Log:
Supplied missing specs for tiebreaking semantics of "longer" names.
As a bonus, supplied conjectural syntax for return type tiebreaking.


Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podMon May  8 16:50:55 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 30 Apr 2006
+  Last Modified: 8 May 2006
   Number: 12
-  Version: 14
+  Version: 15
 
 =head1 Overview
 
@@ -614,7 +614,10 @@
 They are sorted into an order according to how close the actual types
 of the arguments match up with the declared types of the parameters of
 each candidate.  The best candidate is called, unless there's a tie,
-in which case only candidates marked with the C trait are
+in which case the tied candidates are redispatched using any additional
+tiebreaker long names (see below).
+
+If a tie still results, only candidates marked with the C trait are
 considered, and the best matching default routine is used.  If there
 are no default routines, or if the available defaults are also tied,
 a final tie-breaking proto sub is called, if there is one (see above).
@@ -633,9 +636,38 @@
 
 multi sub infix:<..>(Int $min, Int $max: Int $by = 1) {...}
 
+The final colon, if any, determines the complete long name of a multi.
+However, a given multi may advertise multiple long names, some
+of which are shorter than the complete long name.  This is done by
+putting a colon after each advertised long name (replacing the comma,
+if present).  The initial dispatch is always to the shortest advertised
+long name.  Since the shorter long name does not guarantee uniqueness,
+if that shorter long name is chosen for dispatch, and a tie would be
+declared for that dispatch, the next longer set of long names may be
+used to break ties, for those candidates that supply longer names.
+(As a limiting case, marking every parameter as the end of a long
+name produces dispatch semantics like Common Lisp.)
+
 Within a class, C is visible to both method-dispatch
 and subroutine-dispatch.  A C never participates in the
-subroutine-dispatch process.
+subroutine-dispatch process.  It is dispatched just like a normal
+method, then the tie-breaking rules of the previous paragraph are applied.
+That is, the shortest long name of a multi method includes I the
+single invocant, and any additional colons may only indicate long names
+to be used as tiebreakers.
+
+Conjecture: In order to specify dispatch that includes the return
+type context, it is necessary to place a colon after the return type:
+
+multi infix:<..>(Int $min, Int $max: Int $by = 1 --> Iterator:) {...}
+multi infix:<..>(Int $min, Int $max: Int $by = 1 --> Selector:) {...}
+
+Note that such a declaration might have to delay dispatch until the
+actual desired type is known!  (Generally, you might just consider
+returning a flexible C object instead of an anonymous partial
+dispatch that may or may not be resolved at compile time via type
+inferencing.  Therefore return-type tiebreaking need not be supported
+in 6.0.0 unless some enterprising soul decides to make it work.)
 
 =head2 Method call vs. Subroutine call
 


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

2006-05-08 Thread larry
Author: larry
Date: Mon May  8 17:26:05 2006
New Revision: 9139

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

Log:
Clarification of the 0,1,Inf parsing policy.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon May  8 17:26:05 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 6 May 2006
+  Last Modified: 8 May 2006
   Number: 2
-  Version: 38
+  Version: 39
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1615,9 +1615,9 @@
 visible at the point of the controlling C declaration.
 
 Parsing of a bareword function as a provisional call is always done
-the same way list operators are treated.  If a postdeclaration bends
-the syntax to be inconsistent with that, it is an error of the
-inconsistent signature variety.
+the same way list operators are treated.  If a postdeclaration
+bends the syntax to be inconsistent with that, it is an error of
+the inconsistent signature variety.
 
 If the unrecognized subroutine name is followed by C<< postcircumfix:<( )> >>,
 it is compiled as a provisional function call of the parenthesized form.
@@ -1628,6 +1628,31 @@
 arguments, whereas anything following whitespace will be interpreted
 as an argument list if possible.
 
+Based on the signature of the subroutine declaration, there are only
+four ways that an argument list can be parsed:
+
+Signature  # of expected args
+() 0
+($x)   1
+($x?)  0..1
+(anything else)0..Inf
+
+That is, a standard subroutine call may be parsed only as a 0-arg term
+(or function call), a 1-mandatory-arg prefix operator (or function
+call), a 1-optional-arg term or prefix operator (or function call), or
+an "infinite-arg" list operator (or function call).  A given signature
+might only accept 2 arguments, but the only number distinctions the
+parser is allowed to make is between void, singular and plural;
+checking that number of arguments supplied matches some number
+larger than one must be done as a separate semantic constraint, not
+as a syntactic constraint.  Perl functions never take N arguments
+off of a list and leave the rest for someone else, except for small
+values of N, where small is defined as not more than 1.  You can get
+fancier using macros, but macros I require predeclaration.
+Since the non-infinite-list forms are essentially behaving as macros,
+those forms also require predeclaration.  Only the infinite-list form
+may be postdeclared (and hence used provisionally).
+
 It is illegal for a provisional subroutine call to be followed by a
 colon postfix, since such a colon is allowed only on an indirect object,
 or a method call in dot form.  (It is also allowed on a label when a


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

2006-05-09 Thread larry
Author: larry
Date: Tue May  9 14:06:29 2006
New Revision: 9153

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

Log:
Reduce in list context.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podTue May  9 14:06:29 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 1 May 2006
+  Last Modified: 9 May 2006
   Number: 3
-  Version: 26
+  Version: 27
 
 =head1 Changes to existing operators
 
@@ -497,6 +497,15 @@
 @args = (\%a,'foo','bar');
 $x = [dehash] @args;
 
+In scalar context, a reduce operator returns only the final result, but
+in list context, the reduce operator also returns all intermediate results
+lazily:
+
+say [+], 1..*  #  (1, 3, 6, 10, 15, ...)
+
+Unlike other reduction operators, the C<[;]> operator is not sensitive
+to list context.
+
 =head1 Junctive operators
 
 C<|>, C<&>, and C<^> are no longer bitwise operators (see L

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

2006-05-09 Thread larry
Author: larry
Date: Tue May  9 21:26:12 2006
New Revision: 9156

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

Log:
patch from jerry++.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue May  9 21:26:12 2006
@@ -494,8 +494,8 @@
 $   scalar
 @   ordered array
 %   unordered hash (associative array)
-&   code
-::  package/module/class/role/subset/enum/type
+&   code/rule/token/regex
+::  package/module/class/role/subset/enum/type/grammar
 @@  multislice view of @
 
 Within a declaration, the C<&> sigil also declares the visibility of the


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

2006-05-11 Thread larry
Author: larry
Date: Thu May 11 09:55:36 2006
New Revision: 9197

Modified:
   doc/trunk/design/syn/S05.pod

Log:
Changed :words/:w to :sigspace/:s and invented ss/// and ms// (or maybe mm//).


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podThu May 11 09:55:36 2006
@@ -14,9 +14,9 @@
Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
    Larry Wall <[EMAIL PROTECTED]>
Date: 24 Jun 2002
-   Last Modified: 24 Apr 2006
+   Last Modified: 11 May 2006
Number: 5
-   Version: 23
+   Version: 24
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I because they haven't been
@@ -151,10 +151,13 @@
 
 =item *
 
-The new C<:w> (C<:words>) modifier causes whitespace sequences to be
-replaced by C<\s*> or C<\s+> subpattern as defined by the C<<  >> rule.
+The new C<:s> (C<:sigspace>) modifier causes whitespace sequences
+to be considered "significant".  That is, they are replaced by a
+whitespace matching rule, C<<  >>.
 
- m:w/ next cmd =   /
+Anyway,
+
+ m:s/ next cmd =   /
 
 Same as:
 
@@ -166,17 +169,43 @@
 
 But in the case of
 
- m:w { (a|\*) (b|\+) }
+ m:s {(a|\*) (b|\+)}
 
 or equivalently,
 
  m { (a|\*)  (b|\+) }
 
-C<<  >> can't decide what to do until it sees the data.  It still does
-the right thing.  If not, define your own C<<  >> and C<:w> will use that.
+C<<  >> can't decide what to do until it sees the data.
+It still does the right thing.  If not, define your own C<<  >>
+and C<:sigspace> will use that.
 
-In general you don't need to use C<:w> within grammars because
+In general you don't need to use C<:sigspace> within grammars because
 the parser rules automatically handle whitespace policy for you.
+In this context, whitespace often includes comments, depending on
+how the grammar chooses to define its whitespace rule.  Although the
+default C<<  >> subrule recognizes no comment construct, any
+grammar is free to override the rule.  The C<<  >> rule is not
+intended to mean the same thing everywhere.
+
+It's also possible to pass an argument to C<:sigspace> specifying
+a completely different subrule to apply.  This can be any rule, it
+doesn't have to match whitespace.  When discussing this modifier, it is
+important to distinguish the significant whitespace in the pattern from
+the "whitespace" being matched, so we'll call the pattern's whitespace
+I, and generally reserve I to indicate whatever
+C<<  >> matches in the current grammar. The correspondence
+between sigspace and whitespace is primarily metaphorical, which is
+why the correspondence is both useful and (potentially) confusing.
+
+The C<:s> modifier is considered sufficiently important that
+match variants are defined for them:
+
+ms/match some words/   # same as m:sigspace
+ss/match some words/replace those words/   # same ss s:sigspace
+
+Conjecture: This might become sufficiently idiomatic that C would
+be better as a "stuttered" C instead, much as C became idiomatic.
+It would also match C that way.
 
 =item *
 
@@ -311,10 +340,10 @@
 
 =item *
 
-The C<:i>, C<:w>, C<:Perl5>, and Unicode-level modifiers can be
+The C<:i>, C<:s>, C<:Perl5>, and Unicode-level modifiers can be
 placed inside the regex (and are lexically scoped):
 
- m/:w alignment = [:i left|right|cent[er|re]] /
+ m/:s alignment = [:i left|right|cent[er|re]] /
 
 =item *
 
@@ -389,7 +418,7 @@
 =item *
 
 Whitespace is now always metasyntactic, i.e. used only for layout
-and not matched literally (but see the C<:w> modifier described above).
+and not matched literally (but see the C<:sigspace> modifier described above).
 
 =back
 
@@ -604,8 +633,8 @@
  /  /# was /(?=pattern)/
  /  / # was /(? /# match whitespace by :w policy
- /  /# match a space char
+ /  /# match whitespace by :s policy
+ /  /# match the SPACE character (U+0020)
 
  /  /  # match only at a particular StrPos
 # short for 
@@ -966,8 +995,8 @@
 
 If either form needs modifiers, they go before the opening delimiter:
 
- $regex = regex :g:w:i { my name is (.*) };
- $regex = rx:g:w:i / my name is (.*) /;# same thing
+ $regex = regex :g:s:i { my name is (.*) };
+ $regex = rx:g:s:i / my name is (.*) /;# same thing
 
 Space is necessary after the final modifier if you use any
 bracketing character for the delimiter.  (Otherwise it would be taken a

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

2006-05-11 Thread larry
Author: larry
Date: Thu May 11 13:33:29 2006
New Revision: 9202

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

Log:
Various clarifications from jerry++ and others
Extra dot is now allowed before hyper postfix since whitespace disallowed there


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podThu May 11 13:33:29 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 9 May 2006
+  Last Modified: 11 May 2006
   Number: 3
-  Version: 27
+  Version: 28
 
 =head1 Changes to existing operators
 
@@ -28,6 +28,10 @@
 =item * The string concatenation C<.> becomes C<~>.  Think of it as
 "stitching" the two ends of its arguments together.
 
+=item * All postfix operators that do not start with a dot also have
+an alternate form that does.  (The converse does not hold--just because
+you can write C doesn't mean you can write C.)
+
 =item * Unary C<~> now imposes a string (C) context on its argument, and
 C<+> imposes a numeric (C) context (as opposed to being a no-op in Perl
 5).  Along the same lines, C imposes a boolean (C) context, and C<*>
@@ -300,7 +304,10 @@
 "list operations", which operate on each element of two lists (or
 arrays) and return a list (or array) of the results.  Spaces are not
 allowed on the "pointy" end of each "hyper", but are allowed on the
-blunt end. For example:
+blunt end (except for postfix operators, which must still follow postfix
+spacing rules, but do for allow an additional dot before the "hyper").
+
+For example:
 
  (1,1,2,3,5) »+« (1,2,3,5,8);  # (2,3,5,8,13)
 
@@ -312,10 +319,15 @@
 
  @negatives = -« @positives;
 
- @positions »++;# Increment all positions
+ @positions»++;# Increment all positions
 
- @objects ».run();
- ("f","oo","bar")».chars;   # (1,2,3)
+ @positions.»++;   # Same thing, dot form
+ @positions».++;   # Same thing, dot form
+ @positions.».++;  # Same thing, dot form
+ @positions\  .»\  .++;# Same thing, long dot form
+
+ @objects.».run();
+ ("f","oo","bar").>>.chars;   # (1,2,3)
 
 Note that method calls are really postfix operators, not infix, so you
 shouldn't put a C<«> after the dot.
@@ -344,6 +356,9 @@
 my @a = (5,6);
 [*] @a;   # 5 * 6 = 30
 
+As with the all metaoperators, space is not allowed inside.  The whole
+thing parses as a single token.
+
 A reduction operator really is a list operator, and is invoked as one.
 Hence, you maybe implement a reduction operator in one of two ways.  Either
 you can write an explicit list operator:
@@ -403,8 +418,8 @@
 However, the zero argument case must of necessity be handled by the
 proto version, since there is no type information to dispatch on.
 Operators that wish to specify an identity value should do so by
-specifying the proto listop.  Among the builtin operators, [+]()
-returns 0 and [*]() returns 1, for instance.
+specifying the proto listop.  Among the builtin operators, C<[+]()>
+returns 0 and C<[*]()> returns 1, for instance.
 
 By default, if there is one argument, the built-in reduce operators
 return that one argument.  However, this default doesn't make sense
@@ -876,7 +891,7 @@
 Perl 6 has 22 precedence levels (which is fewer than Perl 5):
 
 terms   42 "eek" $x /abc/ (1+2) a(1) :by(2) .meth listop
-method postfix  . .+ .? .* .() .[] .{} .«» .=
+method postfix  . .+ .? .* .() .[] .{} .:: .«» .=
 autoincrement   ++ --
 exponentiation  **
 symbolic unary  ! + - ~ ? $ @ % & * ** +^ ~^ ?^ \ ^ =
@@ -890,7 +905,7 @@
 tight and   &&
 tight or|| ^^ //
 ternary ?? !!
-assignment  = := ::= += -= **= xx= etc. (and also =>)
+assignment  = := ::= += -= **= xx= .= etc. (and also =>)
 list item separator , ¥
 list op (rightward) <== print push any all true not etc. and ()= rightward
 pipe forward==>


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

2006-05-11 Thread larry
Author: larry
Date: Thu May 11 15:39:08 2006
New Revision: 9204

Modified:
   doc/trunk/design/syn/S03.pod
   doc/trunk/design/syn/S05.pod
   doc/trunk/design/syn/S09.pod

Log:
Typos.
Tightened up prefix:<*> to match only before sigils and brackets,
so that *foo now always means GLOBAL::foo, and 0..*:by(2) works.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podThu May 11 15:39:08 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 11 May 2006
   Number: 3
-  Version: 28
+  Version: 29
 
 =head1 Changes to existing operators
 
@@ -360,7 +360,7 @@
 thing parses as a single token.
 
 A reduction operator really is a list operator, and is invoked as one.
-Hence, you maybe implement a reduction operator in one of two ways.  Either
+Hence, you can implement a reduction operator in one of two ways.  Either
 you can write an explicit list operator:
 
 proto prefix:<[+]> ([EMAIL PROTECTED]) {
@@ -674,7 +674,7 @@
 
 Since typeglobs are being removed, unary C<*> may now serve as an
 interpolator, by casting its single operand to a C object
-and insert it into the current argument list.
+and inserting it into the current argument list.
 
 It can be used to interpolate an C or C into the current
 call, as positional and named arguments respectively.
@@ -737,6 +737,26 @@
 
 You may use either of them on a scalar iterator to force it to iterate.
 
+The C<*> operator is recognized only if the next character is a sigil
+or an opening bracket, In front of an alphabetic character C<*> will
+always be taken to mean C.  Otherwise it will be assumed
+the C<*> has no argument.  See next section.
+
+To interpolate a function's return value, therefore, you must say one
+of these:
+
+push *(func())
+push *[func()]
+push *&func()
+
+because
+
+push *func()
+
+means
+
+push GLOBAL::func()
+
 =item * The "Whatever" operator
 
 If the C<*> prefix operator has I argument, it captures the notion
@@ -891,7 +911,7 @@
 Perl 6 has 22 precedence levels (which is fewer than Perl 5):
 
 terms   42 "eek" $x /abc/ (1+2) a(1) :by(2) .meth listop
-method postfix  . .+ .? .* .() .[] .{} .:: .«» .=
+method postfix  . .+ .? .* .() .[] .{} .«» .:: .=
 autoincrement   ++ --
 exponentiation  **
 symbolic unary  ! + - ~ ? $ @ % & * ** +^ ~^ ?^ \ ^ =

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podThu May 11 15:39:08 2006
@@ -152,14 +152,12 @@
 =item *
 
 The new C<:s> (C<:sigspace>) modifier causes whitespace sequences
-to be considered "significant".  That is, they are replaced by a
-whitespace matching rule, C<<  >>.
-
-Anyway,
+to be considered "significant"; they are replaced by a whitespace
+matching rule, C<<  >>.  That is,
 
  m:s/ next cmd =   /
 
-Same as:
+is the same as:
 
  m/  next  cmd  =  /
 

Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podThu May 11 15:39:08 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 13 Sep 2004
-  Last Modified: 21 Apr 2006
+  Last Modified: 11 May 2006
   Number: 9
-  Version: 9
+  Version: 10
 
 =head1 Overview
 
@@ -308,7 +308,7 @@
 just like scalars -- the main caveat is that you have to use
 binding rather than assignment to set one without copying:
 
-@b := @a[0..(*):by(2)]
+@b := @a[0..*:by(2)]
 
 With PDLs in particular, this might alias each of the individual
 elements rather than the array as a whole.  So modifications to @b
@@ -340,7 +340,7 @@
 semicolon-separated list of slice specifiers, also known as a multislice.
 A three-dimensional slice might look like this:
 
-@x[0..10; 1,0; 1..(*):by(2)]
+@x[0..10; 1,0; 1..*:by(2)]
 
 It is up to the implementation of C<@x> to decide how aggressively
 or lazily this subscript is evaluated, and whether the slice entails
@@ -412,9 +412,9 @@
 
 @nums[$min..$max:by(3)]
 @nums[$min..$max]
-@nums[$min..(*):by(3)]
-@nums[1..(*):by(2)]# the odds
-@nums[0..(*):by(2)]# the evens
+@nums[$min..*:by(3)]
+@nums[1..*:by(2)]  # the odds
+@nums[0..*:by(2)]  # the evens
 
 That's all just the standard Perl 6 notation for ranges.  Additional
 syntactic relief is always available as long as it's predeclared


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

2006-05-11 Thread larry
Author: larry
Date: Thu May 11 23:26:34 2006
New Revision: 9208

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

Log:
Cleanup from spinclad++.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu May 11 23:26:34 2006
@@ -1741,9 +1741,6 @@
 :shortkey
 :fookey{ $^a <=> $^b }
 
-But note that C<..> is not a long dot because at least one internal space
-is required to differentiate from the range operator.
-
 =item *
 
 The double-underscore forms are going away:

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podThu May 11 23:26:34 2006
@@ -305,7 +305,7 @@
 arrays) and return a list (or array) of the results.  Spaces are not
 allowed on the "pointy" end of each "hyper", but are allowed on the
 blunt end (except for postfix operators, which must still follow postfix
-spacing rules, but do for allow an additional dot before the "hyper").
+spacing rules, but do allow for an additional dot before the "hyper").
 
 For example:
 


[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, eve

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

2006-05-12 Thread larry
Author: larry
Date: Fri May 12 23:00:37 2006
New Revision: 9226

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

Log:
Capture explosions.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri May 12 23:00:37 2006
@@ -1518,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 operator if necessary.
+the C operator if necessary.
 
 The following means the same as the previous example.
 

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podFri May 12 23:00:37 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 12 May 2006
   Number: 3
-  Version: 30
+  Version: 31
 
 =head1 Changes to existing operators
 
@@ -293,8 +293,16 @@
 of the object on the left.  The C<.^> operator calls a class metamethod;
 C is short for C.
 
-=item * Unary C<=> reads lines from a filehandle or filename, or in general
-iterates an iterator.
+=item * Unary C<=> reads lines from a filehandle or filename, or
+iterates an iterator, or in general causes a scalar to explode its guts
+when it would otherwise not.  How it does that is context senstive.
+For instance, C<=$iterator> is scalar/list sensitive and will
+produce one value in scalar context but many values in list context.
+(Use C<@$iterator> to force a fetch of all the values even in scalar
+context, and C<$$iterator> to force a fetch of a single value even
+in list context.)  On the other hand, C<=$capture> interpolates all
+parts of the capture that makes sense in the current list context,
+depending on what controls that list context.
 
 =back
 
@@ -487,6 +495,7 @@
 [||]()  # Bool::False
 [^^]()  # Bool::False
 [//]()  # undef
+[=]()   # undef(same for all assignment operators)
 [,]()   # ()
 [¥]()   # []
 
@@ -764,6 +773,24 @@
 
 push [,] func()
 
+Within the argument list of a C<[,]>, function return values are
+automatically exploded into their various parts, as if you'd said:
+
+\$capture := func();
+push [,] $$capture: @$capture, %$capture;
+
+or some such.  The C<[,]> then handles the various zones appropriately
+depending on the context.  An invocant only makes sense as the first
+argument to the outer function call.  An invocant inserted anywhere
+else just becomes a positional argument at the front of its list,
+as if its colon changed back to a comma.
+
+If you already have a capture variable, you can interpolated all of its
+bits at once using the C<< prefix:<=> >> operator.  The above is equivalent to
+
+\$capture := func();
+push [,] =$capture;
+
 =head1 Piping operators
 
 The new operators C<< ==> >> and C<< <== >> are akin to UNIX pipes, but

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podFri May 12 23:00:37 2006
@@ -757,7 +757,7 @@
 
 $_  $xType of Match ImpliedMatching Code
 ==  = ==
-Any Code<$>   scalar sub truth match if $x($_)
+Any Code:($)   scalar sub truth match if $x($_)
 HashHash  hash keys identical  match if $_.keys.sort »eq« 
$x.keys.sort
 Hashany(Hash) hash key intersectionmatch if $_{any(Hash.keys)}
 HashArray hash value slice truth   match if $_{any(@$x)}
@@ -776,7 +776,7 @@
 Num NumRange  in numeric range match if $min <= $_ <= $max
 Str StrRange  in string range  match if $min le $_ le $max
 Capture Signature parameter bindingmatch if $cap can bind to $sig
-Any Code<>simple closure truth*match if $x() (ignoring $_)
+Any Code:()simple closure truth*match if $x() (ignoring $_)
 Any Class class membership match if $_.does($x)
 Any Role  role playing match if $_.does($x)
 Any Num   numeric equality match if $_ == $x


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

2006-05-13 Thread larry
Author: larry
Date: Sat May 13 08:51:43 2006
New Revision: 9236

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

Log:
s:g/<'&?SUB'>/&?ROUTINE/ from gaal++


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat May 13 08:51:43 2006
@@ -13,7 +13,7 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 12 May 2006
+  Last Modified: 13 May 2006
   Number: 6
   Version: 34
 
@@ -149,7 +149,7 @@
 It also behaves like a block with respect to control exceptions.  If you
 C from within a pointy sub, it will return from the innermost
 enclosing C or C, not the block itself.  It is referenced
-by C<&?BLOCK>, not C<&?SUB>.
+by C<&?BLOCK>, not C<&?ROUTINE>.
 
 =head2 Stub declarations
 
@@ -1861,7 +1861,7 @@
 
 leave;  # return from innermost block of any kind
 leave Method;   # return from innermost calling method
-leave &?SUB <== 1,2,3;  # Return from current sub. Same as: return 
1,2,3
+leave &?ROUTINE <== 1,2,3;  # Return from current sub. Same as: return 
1,2,3
 leave &foo <== 1,2,3;   # Return from innermost surrounding call to 
&foo
 leave Loop where { .label eq 'COUNT' };  # Same as: last COUNT;
 


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

2006-05-13 Thread larry
Author: larry
Date: Sat May 13 09:07:03 2006
New Revision: 9237

Modified:
   doc/trunk/design/syn/S09.pod

Log:
Clarifications on multidimensional notations.


Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podSat May 13 09:07:03 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 13 Sep 2004
-  Last Modified: 11 May 2006
+  Last Modified: 13 May 2006
   Number: 9
-  Version: 10
+  Version: 11
 
 =head1 Overview
 
@@ -26,8 +26,8 @@
 =head1 Lazy lists
 
 All list contexts are lazy by default.  They still flatten eventually,
-but only when forced to.  You have to use unary C<**> to get a non-lazy
-flattening list context (that is, to flatten immediately like Perl 5).
+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).
 
 =head1 Sized types
 
@@ -136,18 +136,20 @@
 @pieces = $buffer[$n..^$end];
 
 Note that subscripting still pulls the elements out as numbers,
-but C returns the same buffer type.
+but C returns a buffer of the same type.
 
 =head1 Multidimensional arrays
 
 The declarations above declare one-dimensional arrays of indeterminate
-length.  Such arrays are autoextending just like ordinary Perl
-arrays (at the price of occasionally copying the block of data to
-another memory location).  For many purposes, though, it's useful to
-define array types of a particular size and shape that, instead of
-autoextending, throw an exception if you try to access outside their
-declared dimensionality.  Such arrays tend to be faster to allocate and
-access as well.
+length.  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).  For many purposes,
+though, it's useful to define array types of a particular size and
+shape that, instead of autoextending, throw an exception if you try
+to access outside their declared dimensionality.  Such arrays tend
+to be faster to allocate and access as well.  (The language must,
+however, continue to protect you against overflow--these days, that's
+not just a reliability issue, but also a security issue.)
 
 A multidimensional array is indexed by a semicolon list, which is really
 a list of pipes in disguise.  Each sublist is a slice/pipe of one particular
@@ -202,7 +204,7 @@
 
 Conjecture, since @@x and @x are really the same object, any array can
 keep track of its dimensionality, and it only matters how you use it
-in the end:
+in contexts that care about the dimensionality:
 
 my @x;
 @x <==  %hash.keys.grep: {/^X/};
@@ -214,7 +216,7 @@
 [EMAIL PROTECTED]  # flattened
 
 To declare a multidimensional array, you may declare it with a signature as
-if it were a function returning one of its entries:
+if it were a function returning I of its entries:
 
 my num @nums (Int);   # one dimension, @nums[Int]
 
@@ -235,10 +237,11 @@
 
 my int @ints (1..4, 1..2); # two dimensions, @ints[1..4; 1..2]
 
-Note that this only influences your view of the array, not the actual
-shape of the array.  If you pass this array to another module, it
-will see it as have a shape of C<(0..3, 0..1)> unless it also declares
-a variable to view it differently.
+Note that this only influences your view of the array in the current
+lexical scope, not the actual shape of the array.  If you pass
+this array to another module, it will see it as having a shape
+of C<(0..3,0..1)> unless it also declares a variable to view it
+differently.
 
 Alternately, you may declare it using a prototype subscript,
 but then you must remember to use semicolons instead of commas to
@@ -253,6 +256,7 @@
 
 You can pass a multislice for the shape as well:
 
+@@fooshape = (0..3; 0..1);
 my int @ints[[;[EMAIL PROTECTED];
 my int @ints[@@fooshape];  # same thing
 
@@ -290,6 +294,17 @@
 
 (presuming C and C are types already constrained to be even or odd).
 
+The C type will be taken to mean C within an array
+subscript, so you can also write:
+
+my int @ints[^42; *];
+
+Saying
+
+my int @ints[^42; **];
+
+would give you an array of indeterminate dimensionality.
+
 =head1 PDL support
 
 An array C<@array> can be tied to a PDL at declaration time:
@@ -385,7 +400,9 @@
 
 But you should maybe write the last form anyway just for good
 documentation, unless you don't actually know how many more dimensions
-there are.
+there are.  For that case you may use C<**>:
+
+@nums[0,1,2;**]
 
 If you wanted that C<0..2> range to mean
 
@@ -440,7 +457,7 @@
 
 0 .. Inf :by(2)
 
-That's why we have postfix C<..*> to mean C<..Inf>.
+That's why we have C<..*> to mean C<..Inf>.
 
 =

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

2006-05-13 Thread larry
Author: larry
Date: Sat May 13 09:15:35 2006
New Revision: 9238

Modified:
   doc/trunk/design/syn/S05.pod

Log:
:ratchet behavior was unclearly written, from scw++


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podSat May 13 09:15:35 2006
@@ -14,7 +14,7 @@
Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
    Larry Wall <[EMAIL PROTECTED]>
Date: 24 Jun 2002
-   Last Modified: 11 May 2006
+   Last Modified: 13 May 2006
Number: 5
Version: 24
 
@@ -1172,11 +1172,12 @@
  /
 
 (i.e. there's no point trying to match a different keyword if one was
-already found but failed).  Note that you can still back into such an
-alternation, so you may also need to put C<:> after it if you also
-want to disable that.  If a an explicit or implicit C<:ratchet> has
-disabled backtracking, you need to put C<:+> after the alternation
-to enable backing into another alternative if the first pick fails.
+already found but failed).  Note that you can still back into such
+an alternation, so you may also need to put C<:> after it if you
+also want to disable that.  If an explicit or implicit C<:ratchet>
+has disabled backtracking by supplying an implicit C<:>, you need to
+put an explicit C<:+> after the alternation to enable backing into
+another alternative if the first pick fails.
 
 =item *
 


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

2006-05-14 Thread larry
Author: larry
Date: Sun May 14 10:39:58 2006
New Revision: 9253

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

Log:
Got rid of default @@_ array and postfix ==>.
May now pipe to * multiple times.
Pipe batches sent to * are received with *** now.
(*** also specifies receiver location for current pointy end.)


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSun May 14 10:39:58 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 12 May 2006
+  Last Modified: 14 May 2006
   Number: 2
-  Version: 40
+  Version: 41
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -506,6 +506,12 @@
 is effectively immutable, the optimizer is free to recognize C<*>
 and optimize in the context of what operator it is being passed to.
 
+A variant of C<*> is the C<**> term.  It is generally understood to
+be a multidimension form of C<*> when that makes sense.
+
+The C<***> variant serves as the insertion point of a list of pipes.
+That insertion point may be targeted by piping to C<*>.  See S06.
+
 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

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSun May 14 10:39:58 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 13 May 2006
+  Last Modified: 14 May 2006
   Number: 6
-  Version: 34
+  Version: 35
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -860,6 +860,25 @@
 operation, it must be something else that can be interpreted as a
 list receiver.
 
+Any list operator is considered a variadic operation, so ordinarily
+a list operator adds any piped input to the end of its list.
+But sometimes you want to interpolate elsewhere, so the C<***> term
+may be used to indicating the target of a pipe without the use of a
+temporary array:
+
+foo() ==> say ***, " is what I meant";
+bar() ==> ***.baz();
+
+Piping to the C<*> "whatever" term is considered a pipe to the lexically
+following C<***> term:
+
+0..*   ==> *;
+'a'..* ==> *;
+pidigits() ==> *;
+
+# outputs "(0, 'a', 3)\n"...
+for zip(***) { .perl.say }
+
 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.
 Do not think of it as an assignment, nor as an ordinary binding.
@@ -979,19 +998,8 @@
 In particular, you can use C<@@foo> to interpolate a multidimensional slice
 in an array or hash subscript.
 
-Every lexical scope can use its own implicitly declared C<@_> variable
-as the default receiver.  So instead of using C<@@foo> above you can
-just say
-
-0..*   ==> ;
-'a'..* ==> ;
-pidigits() ==> ;
-
-# outputs "(0, 'a', 3)\n"...
-for zip(@@_) { .perl.say }
-
-If C<@@_> is currently empty, then C would act on a
-zero-dimensional slice (i.e. C), and output nothing
+If C<@@foo> is currently empty, then C acts on a
+zero-dimensional slice (i.e. C), and outputs nothing
 at all.
 
 Note that with the current definition, the order of pipes is preserved
@@ -999,14 +1007,14 @@
 
 So
 
-('a'..*; 0..*) ==> ;
- for zip(@@_ <== @foo) -> [$a, $i, $x] { ...}
+('a'..*; 0..*) ==> *;
+ for zip(*** <== @foo) -> [$a, $i, $x] { ...}
 
 is the same as
 
-'a'..* ==> ;
- 0..*  ==> ;
- for zip(@@_ <== @foo) -> [$a, $i, $x] { ...}
+'a'..* ==> *;
+ 0..*  ==> *;
+ for zip(*** <== @foo) -> [$a, $i, $x] { ...}
 
 which is the same as
 
@@ -1014,14 +1022,14 @@
 
 And
 
-@foo ==> ;
-0..* ==> ;
-for each(@@_) -> $x, $i { ...}
+@foo ==> *;
+0..* ==> *;
+for each(***) -> $x, $i { ...}
 
 is the same as
 
-0..* ==> ;
-for each(@foo; @@_) -> $x, $i { ...}
+0..* ==> *;
+for each(@foo; ***) -> $x, $i { ...}
 
 which is the same as
 


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

2006-05-15 Thread larry
Author: larry
Date: Mon May 15 19:31:05 2006
New Revision: 9258

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

Log:
Rerationalized loose operator precedence.
New loose unary precedence level tighter than comma for "not" and "true".
The two levels looser than listops are now "things that separate lists" and
"things that separate logic" (with "and" arbitrarily placed in the former
category along with zip and both pipe operators).


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podMon May 15 19:31:05 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 12 May 2006
+  Last Modified: 15 May 2006
   Number: 3
-  Version: 31
+  Version: 32
 
 =head1 Changes to existing operators
 
@@ -923,10 +923,10 @@
 tight or|| ^^ //
 ternary ?? !!
 assignment  = := ::= += -= **= xx= .= etc. (and also =>)
-list item separator , ¥
-list op (rightward) <== print push any all true not etc. and ()= rightward
-pipe forward==>
-loose and   and
-loose oror xor err
+loose unary true not
+list item separator ,
+list op (rightward) print push any all etc. and ()= rightward
+list infix  ¥ <== ==> and
+logic infix or xor err
 expr terminator ; {} as control block, statement modifiers
 


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

2006-05-15 Thread larry
Author: larry
Date: Mon May 15 19:49:41 2006
New Revision: 9259

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

Log:
separated logicals back out, combined all comma-ish things in one level.
but still 22 levels...


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podMon May 15 19:49:41 2006
@@ -924,9 +924,11 @@
 ternary ?? !!
 assignment  = := ::= += -= **= xx= .= etc. (and also =>)
 loose unary true not
-list item separator ,
-list op (rightward) print push any all etc. and ()= rightward
-list infix  ¥ <== ==> and
-logic infix or xor err
+list ops, print push any all etc. and ()= rightward
+list infix  ¥ <== ==>
+loose and   and
+loose oror xor err
 expr terminator ; {} as control block, statement modifiers
 
+Comma is the only listop that is allowed to occur where an operator is
+expected.  All other listops function as a term within the list to the left.


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

2006-05-15 Thread larry
Author: larry
Date: Mon May 15 22:30:10 2006
New Revision: 9260

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

Log:
missing dot-postfix falls back to corresponding prefix operator


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon May 15 22:30:10 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 14 May 2006
+  Last Modified: 15 May 2006
   Number: 2
-  Version: 41
+  Version: 42
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -2043,7 +2043,7 @@
 
 term:<...>  $x = {...}
 quote:  qX/foo/
-prefix:<+>  +$x
+prefix:  !$x (and $x.! if no 
postfix:)
 infix:<+>   $x + $y
 postfix:<++>$x++
 circumfix:<[ ]> [ @x ]

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podMon May 15 22:30:10 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 15 May 2006
   Number: 3
-  Version: 32
+  Version: 33
 
 =head1 Changes to existing operators
 
@@ -30,7 +30,10 @@
 
 =item * All postfix operators that do not start with a dot also have
 an alternate form that does.  (The converse does not hold--just because
-you can write C doesn't mean you can write C.)
+you can write C doesn't mean you can write C.)  In the
+absence of a postfix interpretation, the dot form will call the corresponding
+prefix operator instead.  So C will call C unless someone
+defines a postfix C operator.
 
 =item * Unary C<~> now imposes a string (C) context on its
 argument, and C<+> imposes a numeric (C) context (as opposed
@@ -911,7 +914,7 @@
 method postfix  . .+ .? .* .() .[] .{} .«» .:: .=
 autoincrement   ++ --
 exponentiation  **
-symbolic unary  ! + - ~ ? $ @ % & * ** +^ ~^ ?^ \ ^ =
+symbolic unary  ! + - ~ ? $ @ % & +^ ~^ ?^ \ ^ =
 multiplicative  * / % x xx +& +< +> ~& ~< ~>
 additive+ - ~ +| +^ ~| ~^
 junctive and (all)  &


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

2006-05-16 Thread larry
Author: larry
Date: Tue May 16 15:57:12 2006
New Revision: 9261

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

Log:
s/Tuple/Seq/


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue May 16 15:57:12 2006
@@ -354,7 +354,7 @@
 Built-in object types start with an uppercase letter. This includes
 immutable types (e.g. C, C, C, C, C,
 C, C, C, C, C, B, C,
-C), as well as mutable (container) types, such as C,
+C), as well as mutable (container) types, such as C,
 C, C, C, C, C, etc.
 
 Non-object (native) types are lowercase: C, C, C,


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

2006-05-18 Thread larry
Author: larry
Date: Thu May 18 16:23:46 2006
New Revision: 9299

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

Log:
Clarification on xx operator semantics.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podThu May 18 16:23:46 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 15 May 2006
+  Last Modified: 18 May 2006
   Number: 3
-  Version: 33
+  Version: 34
 
 =head1 Changes to existing operators
 
@@ -59,7 +59,10 @@
 
 =item * C splits into two operators: C (which concatenates repetitions 
 of a string to produce a single string), and C (which creates a list of 
-repetitions of a list or scalar).
+repetitions of a list or scalar).  C<"foo" xx *> represents an arbitrary
+number of copies, useful for initializing lists.  The left side of
+an C is evaluated only once.  (To call a block repeatedly, use a C
+instead.)
 
 =item * Trinary C becomes C.  It is a syntax error to use an
 operator in the middle that binds looser in precedence, such as C<=>.


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

2006-05-19 Thread larry
Author: larry
Date: Fri May 19 11:13:09 2006
New Revision: 9302

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

Log:
Refined hyperops a bit.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podFri May 19 11:13:09 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 18 May 2006
+  Last Modified: 19 May 2006
   Number: 3
-  Version: 34
+  Version: 35
 
 =head1 Changes to existing operators
 
@@ -326,7 +326,7 @@
 
  (1,1,2,3,5) »+« (1,2,3,5,8);  # (2,3,5,8,13)
 
-If one argument is insufficiently dimensioned, Perl "upgrades" it:
+If either argument is insufficiently dimensioned, Perl "upgrades" it:
 
  (3,8,2,9,3,8) >>-<< 1;  # (2,7,1,8,2,7)
 
@@ -354,11 +354,26 @@
 [[1, 2], 3] »+« [4, [5, 6]]  #[[1,2] »+« 4, 3 »+« [5, 6]]
  # == [[5, 6], [8, 9]]
 
-You are not allowed to define your own hyper operators, because they are
-supposed to have consistent semantics derivable entirely from the modified
-scalar operator.  If you're looking for a mathematical vector product, this
-isn't where you'll find it.  A hyperoperator is one of the ways that you
-can promise to the optimizer that your code is parallelizable.
+More generally, hyper operators work recursively for any object
+matching the C role even if the object itself doesn't support
+the operator in question:
+
+Bag(3,8,[2,Seq(9,3]],8) >>-<< 1; # Bag(2,7,[1,Seq(8,2)],7)
+Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,1,1); # Bag(2,7,[1,Seq(8,2)],7)
+Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,2,1); # Bag(2,7,[2,Seq(9,3)],7)
+
+In particular, tree node types with C semantics enable visitation:
+
+$tree.».foo;   # short for $tree.each: { .foo }
+
+You are not allowed to define your own hyper operators, because they
+are supposed to have consistent semantics derivable entirely from
+the modified scalar operator.  If you're looking for a mathematical
+vector product, this isn't where you'll find it.  A hyperoperator
+is one of the ways that you can promise to the optimizer that your
+code is parallelizable.  (The tree visitation above is allowed to
+have side effects, but it is erroneous for the meaning of those side
+effects to depend on the order of visitation.)
 
 =head1 Reduction operators
 


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

2006-05-19 Thread larry
Author: larry
Date: Fri May 19 11:45:34 2006
New Revision: 9303

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

Log:
Typo from aufrank++.
Feeble attempt to make .foo optional on nodes that only contain children.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podFri May 19 11:45:34 2006
@@ -360,11 +360,11 @@
 
 Bag(3,8,[2,Seq(9,3]],8) >>-<< 1; # Bag(2,7,[1,Seq(8,2)],7)
 Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,1,1); # Bag(2,7,[1,Seq(8,2)],7)
-Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,2,1); # Bag(2,7,[2,Seq(9,3)],7)
+Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,2,1); # Bag(2,7,[0,Seq(7,1)],7)
 
 In particular, tree node types with C semantics enable visitation:
 
-$tree.».foo;   # short for $tree.each: { .foo }
+$tree.».foo;   # short for $tree.each: { .?foo; .».foo }
 
 You are not allowed to define your own hyper operators, because they
 are supposed to have consistent semantics derivable entirely from


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

2006-05-19 Thread larry
Author: larry
Date: Fri May 19 16:29:33 2006
New Revision: 9304

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

Log:
dduncan++ points out that bags are unordered, which actually forces asymmetry.
Clarified difference between ».foo and ».?foo


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podFri May 19 16:29:33 2006
@@ -330,7 +330,13 @@
 
  (3,8,2,9,3,8) >>-<< 1;  # (2,7,1,8,2,7)
 
-When using a unary operator, only put it on the side of the single operand:
+In fact, this is the I form that will work for an unordered type
+such as a Bag:
+
+ Bag(3,8,2,9,3,8) >>-<< 1;   # Bag(2,7,1,8,2,7) ~~ Bag(1,2,2,7,7,8)
+
+When using a unary operator, only put the "hyper" on the side of the
+single operand:
 
  @negatives = -« @positives;
 
@@ -358,13 +364,18 @@
 matching the C role even if the object itself doesn't support
 the operator in question:
 
-Bag(3,8,[2,Seq(9,3]],8) >>-<< 1; # Bag(2,7,[1,Seq(8,2)],7)
-Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,1,1); # Bag(2,7,[1,Seq(8,2)],7)
-Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,2,1); # Bag(2,7,[0,Seq(7,1)],7)
+Bag(3,8,[2,Seq(9,3)],8) >>-<< 1; # Bag(2,7,[1,Seq(8,2)],7)
+Seq(3,8,[2,Seq(9,3)],8) >>-<< (1,1,2,1); # Seq(2,7,[0,Seq(7,1)],7)
 
 In particular, tree node types with C semantics enable visitation:
 
-$tree.».foo;   # short for $tree.each: { .?foo; .».foo }
+$tree.».foo;   # short for $tree.foo, $tree.each: { .».foo }
+
+If not all nodes support the operation, you need a form of it that
+specifies the call is optional:
+
+$tree.».?foo;  # short for $tree.?foo, $tree.each: { .».?foo }
+$tree.».*foo;  # short for $tree.*foo, $tree.each: { .».*foo }
 
 You are not allowed to define your own hyper operators, because they
 are supposed to have consistent semantics derivable entirely from
@@ -373,7 +384,9 @@
 is one of the ways that you can promise to the optimizer that your
 code is parallelizable.  (The tree visitation above is allowed to
 have side effects, but it is erroneous for the meaning of those side
-effects to depend on the order of visitation.)
+effects to depend on the order of visitation.  [Conjecture: we could
+allow dependencies that assume top-down visitation and only leaves
+sibling calls unordered.])
 
 =head1 Reduction operators
 


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

2006-05-23 Thread larry
Author: larry
Date: Tue May 23 12:54:49 2006
New Revision: 9306

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

Log:
Ambiguity noted by spinclad++.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue May 23 12:54:49 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 15 May 2006
+  Last Modified: 23 May 2006
   Number: 2
-  Version: 42
+  Version: 43
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1252,8 +1252,8 @@
 Characters indexed by hex, octal, and decimal can be interpolated
 into strings using either C<"\x123"> (with C<\o> and C<\d> behaving
 respectively) or using square brackets: C<"\x[123]">.  Multiple
-characters may be put into any of these by separating the numbers
-with comma: C<"\x[41,42,43]">.
+characters may be specified within any of the bracketed forms by
+separating the numbers with comma: C<"\x[41,42,43]">.
 
 =item *
 


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

2006-05-25 Thread larry
Author: larry
Date: Thu May 25 11:21:16 2006
New Revision: 9307

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

Log:
Clarifying the distinction between the "of" and "where" return types.


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podThu May 25 11:21:16 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 14 May 2006
+  Last Modified: 24 May 2006
   Number: 6
-  Version: 35
+  Version: 36
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -288,7 +288,7 @@
 including Unicode characters. For example:
 
 sub infix:<(c)> ($text, $owner) { return $text but Copyright($owner) }
-method prefix:<±> (Num $x) returns Num { return +$x | -$x }
+method prefix:<±> (Num $x --> Num) { return +$x | -$x }
 multi sub postfix: (Int $n) { $n < 2 ?? 1 !! $n*($n-1)! }
 macro circumfix:«» ($text) is parsed / .*? / { "" }
 
@@ -1238,7 +1238,7 @@
 
 Note that unlike a sub declaration, a regex-embedded signature has no
 associated "returns" syntactic slot, so you have to use C<< --> >>
-within the signature to specify the type of the signature, or match as
+within the signature to specify the C type of the signature, or match as
 an arglist:
 
 :(Num, Num --> Coord)
@@ -1395,15 +1395,21 @@
 Explicit types are optional. Perl variables have two associated types:
 their "value type" and their "implementation type".  (More generally, any
 container has an implementation type, including subroutines and modules.)
+The value type is stored as its C property, while the implementation
+type of the container is just the object type of the container itself.
 
 The value type specifies what kinds of values may be stored in the
-variable. A value type is given as a prefix or with the C or
-C keywords:
+variable. A value type is given as a prefix or with the C keyword:
 
 my Dog $spot;
-my $spot returns Dog;
 my $spot of Dog;
 
+In either case this sets the C property of the container to C.
+Subroutines have a variant of the C property, C, that
+sets the C property instead.  The C property specifies
+a constraint to be checked upon calling C that, unlike the C
+property, is not advertized as the type of the routine:
+
 our Animal sub get_pet() {...}
 sub get_pet() returns Animal {...}
 sub get_pet() of Animal {...}
@@ -1431,6 +1437,13 @@
 run-time C statement unless the variable is explicitly declared
 with an implementation type that does the C role.
 
+However, package variables are always considered C by default.
+As a consequence, all named packages are also C by default.
+Classes and modules may be viewed as differently tied packages.
+Looking at it from the other direction, classes and modules that
+wish to be bound to a global package name must be able to do the
+C role.
+
 =head2 Hierarchical types
 
 A non-scalar type may be qualified, in order to specify what type of
@@ -1449,19 +1462,16 @@
 
 actually means:
 
-my Hash[returns => Array[returns => Recipe]] %book; 
+my Hash[of => Array[of => Recipe]] %book; 
 
 Because the actual variable can be hard to find when complex types are
 specified, there is a postfix form as well:
 
 my Hash of Array of Recipe %book;   # HoHoAoRecipe
 my %book of Hash of Array of Recipe;# same thing
-my %book returns Hash of Array of Recipe;   # same thing
 
-The C form is more commonly seen in subroutines:
+The C form may be used in subroutines:
 
-my Hash of Array of Recipe sub get_book ($key) {...}
-my sub get_book ($key) of Hash of Array of Recipe {...}
 my sub get_book ($key) returns Hash of Array of Recipe {...}
 
 Alternately, the return type may be specified within the signature:
@@ -1469,8 +1479,14 @@
 my sub get_book ($key --> Hash of Array of Recipe) {...}
 
 There is a slight difference, insofar as the type inferencer will
-ignore a C but pay attention to C<< --> >> or prefix type 
declarations.
-Only the inside of the subroutine pays attention to C.
+ignore a C but pay attention to C<< --> >> or prefix type
+declarations, also known as the C type.  Only the inside of the
+subroutine pays attention to C.
+
+You may also specify the C type as the C trait:
+
+my Hash of Array of Recipe sub get_book ($key) {...}
+my sub get_book ($key) of Hash of Array of Recipe {...}
 
 =head2 Polymorphic types
 
@@ -1524,42 +1540,53 @@
 =head2 Return types
 
 On a scoped subroutine, a return type can be specified before or
-after the name:
-
-our Egg sub lay {...}
-our sub lay returns Egg {...}
-
-my Rabbit sub hat {...}
-my sub hat returns Rabbit {...}
+after the name.  We call all return types &quo

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

2006-05-26 Thread larry
Author: larry
Date: Fri May 26 09:57:12 2006
New Revision: 9310

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

Log:
Clarifications of inner type from sam++.
Deployment of julian++ at 200605252055, 8`lb + 7`oz, 20`in.
   Ref: http://www.wall.org/cgi-bin/photo/index.cgi?mode=view&album=/pix/Julian


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri May 26 09:57:12 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 24 May 2006
+  Last Modified: 26 May 2006
   Number: 6
-  Version: 36
+  Version: 37
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1405,14 +1405,20 @@
 my $spot of Dog;
 
 In either case this sets the C property of the container to C.
-Subroutines have a variant of the C property, C, that
-sets the C property instead.  The C property specifies
-a constraint to be checked upon calling C that, unlike the C
-property, is not advertized as the type of the routine:
-
-our Animal sub get_pet() {...}
-sub get_pet() returns Animal {...}
-sub get_pet() of Animal {...}
+
+Subroutines have a variant of the C property, C, that sets
+the C property instead.  The C property specifies a
+constraint (or perhaps coercion) to be enforced on the return value (either
+by explicit call to C or by implicit fall-off-the-end return).
+This constraint, unlike the C property, is not advertised as the
+type of the routine.  You can think of it as the implicit type signature of
+the (possibly implicit) return statement.  It's therefore available for
+type inferencing within the routine but not outside it.  If no inner type
+is declared, it is assumed to be the same as the C type, if declared.
+
+sub get_pet() of Animal {...}  # of type, obviously
+our Animal sub get_pet() {...} # of type
+sub get_pet() returns Animal {...} # inner type
 
 A value type on an array or hash specifies the type stored by each element:
 
@@ -1539,19 +1545,21 @@
 
 =head2 Return types
 
-On a scoped subroutine, a return type can be specified before or
-after the name.  We call all return types "return types", but distinguish
-two kinds of return type, the C type from the C type, because
-the C type must be an "official" named type, while the C type
-is merely applied as a constraint to what may be returned by the routine.
+On a scoped subroutine, a return type can be specified before or after
+the name.  We call all return types "return types", but distinguish
+two kinds of return type, the C type and the C type,
+because the C type is normally an "official" named type and
+declares the official interface to the routine, while the C
+type is merely a constraint on what may be returned by the routine
+from the routine's point of view.
 
+our sub lay returns Egg {...}  # inner type
 our Egg sub lay {...}  # of type
-our sub lay returns Egg {...}  # where type
 our sub lay of Egg {...}   # of type
 our sub lay (--> Egg) {...}# of type
 
+my sub hat returns Rabbit {...}# inner type
 my Rabbit sub hat {...}# of type
-my sub hat returns Rabbit {...}# where type
 my sub hat of Rabbit {...} # of type
 my sub hat (--> Rabbit) {...}  # of type
 
@@ -1559,14 +1567,14 @@
 namespace (module, class, grammar, or package), as if it's scoped with
 the C scope modifier. Any return type must go after the name:
 
-sub lay returns Egg {...}  # where type
+sub lay returns Egg {...}  # inner type
 sub lay of Egg {...}   # of type
 sub lay (--> Egg) {...}# of type
 
 On an anonymous subroutine, any return type can only go after the C
 keyword:
 
-$lay = sub returns Egg {...};  # where type
+$lay = sub returns Egg {...};  # inner type
 $lay = sub of Egg {...};   # of type
 $lay = sub (--> Egg) {...};# of type
 
@@ -1581,12 +1589,12 @@
 The return type may also be specified after a C<< --> >> token within
 the signature.  This doesn't mean exactly the same thing as C.
 The C type is the "official" return type, and may therefore be
-used to do type inferencing outside the sub.  The C type only
+used to do type inferencing outside the sub.  The C type only
 makes the return type available to the internals of the sub so that
 the C statement can know its context, but outside the sub we
 don't know anything about the return value, as if no return type had
 been declared.  The prefix form specifies the C type rather than
-the C type, so the return type of
+the C type, so the return type of
 
 my Fish sub wanda ($x) { ... }
 
@@ -1598,7 +1606,7 @@
 
 my sub w

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

2006-06-03 Thread larry
Author: larry
Date: Sat Jun  3 19:13:10 2006
New Revision: 9462

Modified:
   doc/trunk/design/syn/S12.pod

Log:
Clarified scoping of "has $x" and friends.


Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podSat Jun  3 19:13:10 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 8 May 2006
+  Last Modified: 3 Jun 2006
   Number: 12
-  Version: 15
+  Version: 16
 
 =head1 Overview
 
@@ -360,14 +360,26 @@
 Public attributes have a secondary sigil of "dot", indicating
 the automatic generation of an accessor method of the same name.
 Private attributes use an exclamation to indicate that no public accessor is
-generated.  The exclamation is optional, so these are identical in effect:
+generated.
 
 has $!brain;
-has $brain;
 
-And any later references to the private variable may either use or
-omit the exclamation, as you wish to emphasize or ignore the privacy
-of the variable.
+The "true name" of the private variable always has the exclamation, but
+much like with C variables, you may declare a lexically scoped alias
+to the private variable by saying:
+
+has $brain;# also declares $!brain;
+
+And any later references to the private variable within the same block
+may either use or omit the exclamation, as you wish to emphasize or
+ignore the privacy of the variable.  Outside the block, you must use
+the C form.  If you declare with the C form, you must use that
+form consistently everywhere.  If you declare with the C<.> form, you
+also get the private C form as a non-virtual name for the actual
+storage location, and you may use either C or C<.> form anywhere
+within the class, even if the class is reopened.  Outside the class
+you must use the public C<.> form, or rely on a method call (which
+can be a private method call, but only for trusted classes).
 
 For public attributes, some traits are copied to the accessor method.
 The C trait causes the generated accessor to be declared C,


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

2006-06-03 Thread larry
Author: larry
Date: Sat Jun  3 19:45:11 2006
New Revision: 9463

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

Log:
Change default lvalue parsing to default to list, with short list of scalars.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Jun  3 19:45:11 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 19 May 2006
+  Last Modified: 3 Jun 2006
   Number: 3
-  Version: 35
+  Version: 36
 
 =head1 Changes to existing operators
 
@@ -109,22 +109,35 @@
 
 loop ($a = 1, $b = 2; ; $a++, $b++) {...}
 
-still works fine.  The distinction between scalar and list assignment
-is similar to the way Perl 5 does it.  If there are parens around
-the left side, or if the variable is an array or hash, it's a list
-assignment.  Otherwise it's a scalar assignment.  One difference from
-Perl 5 is that Perl 6 does not attempt to intuit whether an lvalue
-slice is meant to be one element or several, so you must use parens
-in that case.  This is true even if you put something that is obviously
-a list as the subscript:
-
-@x[1,2,3] = 4,5,6; # WRONG
-(@x[1,2,3]) = 4,5,6;   # correct
-
-These parens actually apply list context on both sides:
-
-@x[foo()] = bar(); # foo() and bar() both in scalar context
-(@x[foo()]) = bar();   # foo() and bar() both in list context
+still works fine.  The distinction between scalar and list
+assignment is similar to the way Perl 5 does it, but has to be a
+little different because we can no longer decide on the basis of
+the sigil.  The following forms are defined as "obviously simple",
+and imply scalar assignment:
+
+$a # simple scalar variable
+@a[123]# single literal subscript
+%a{'x'}# single literal subscript
+%a  # single literal subscript
+@a[+TERM]  # single term coerced to numeric for array
+%a{~TERM}  # single term coerced to string for hash
+@a[SIMPLE] # any of these simples used as subscript recursively
+%a[SIMPLE] # any of these simples used as subscript recursively
+
+All other forms imply list assignment, and will evaluate both sides
+of the assignment in list context (eventually).   However, this is
+primarily a syntactic distinction, and no semantic or type information
+is used, since it influences subsequent parsing.  In particular, even
+if a function is known to return a scalar value from its declaration,
+you must use C<+> or or C<~> to use it as a scalar within a subscript:
+
+@a[foo()] = bar(); # foo() and bar() called in list context
+@a[+foo()] = bar();# foo() and bar() called in scalar 
context
+
+(But note that the first form still works fine if C and C
+are scalar functions that are not context sensitive.  The difference
+in parsing is only an issue if C is followed by a comma or
+some such.)
 
 =item * List operators are all parsed consistently.  As in Perl 5,
 to the left they look like terms, while to the right they look like


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

2006-06-03 Thread larry
Author: larry
Date: Sat Jun  3 20:32:43 2006
New Revision: 9465

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

Log:
Revisions to definitions of simple scalar.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Jun  3 20:32:43 2006
@@ -116,14 +116,37 @@
 and imply scalar assignment:
 
 $a # simple scalar variable
-@a[123]# single literal subscript
-%a{'x'}# single literal subscript
+@a[SIMPLE] # single simple subscript
+%a{SIMPLE} # single simple subscript
 %a  # single literal subscript
-@a[+TERM]  # single term coerced to numeric for array
-%a{~TERM}  # single term coerced to string for hash
+
+Where SIMPLE is defined as 
+
+123# single literal
+'x'# single literal
+"$x"   # single literal
+qq/$x/ # single literal
++TERM  # any single term coerced to numeric
+-TERM  # any single term coerced to numeric
+~TERM  # any single term coerced to string
+?TERM  # any single term coerced to boolean
+!TERM  # any single term coerced to boolean
 @a[SIMPLE] # any of these simples used as subscript recursively
 %a[SIMPLE] # any of these simples used as subscript recursively
 
+We also include:
+
+OP SIMPLE  
+SIMPLE OP
+SIMPLE OP SIMPLE
+
+where C is includes any standard scalar operators in the five
+precedence levels autoincrement, exponentiation, symbolic unary,
+multiplicative, and additive; but these are limited to standard
+operators that are known to return numbers, strings, or booleans.
+(Operators that imply list operations are excluded: C<$>, C<@>,
+and C, for instance.  Hyper operators are also excluded.)
+
 All other forms imply list assignment, and will evaluate both sides
 of the assignment in list context (eventually).   However, this is
 primarily a syntactic distinction, and no semantic or type information


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

2006-06-03 Thread larry
Author: larry
Date: Sat Jun  3 20:43:33 2006
New Revision: 9466

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

Log:
typo from scook0++


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Jun  3 20:43:33 2006
@@ -132,7 +132,7 @@
 ?TERM  # any single term coerced to boolean
 !TERM  # any single term coerced to boolean
 @a[SIMPLE] # any of these simples used as subscript recursively
-%a[SIMPLE] # any of these simples used as subscript recursively
+%a{SIMPLE} # any of these simples used as subscript recursively
 
 We also include:
 


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

2006-06-04 Thread larry
Author: larry
Date: Sun Jun  4 14:40:47 2006
New Revision: 9496

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

Log:
typo from szbalint++


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSun Jun  4 14:40:47 2006
@@ -39,7 +39,7 @@
 argument, and C<+> imposes a numeric (C) context (as opposed
 to being a no-op in Perl 5).  Along the same lines, C imposes
 a boolean (C) context, and the C<[,]> list operator imposes
-an function-arguments (C) context on its argumetns.
+an function-arguments (C) context on its arguments.
 Unary sigils impose the container context implied by their sigil.
 As with Perl 5, however, C<$$foo[bar]> parses as C<$($foo)[bar]>,
 so you need C<$($foo[bar])> to mean the other way.


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

2006-06-04 Thread larry
Author: larry
Date: Sun Jun  4 16:20:16 2006
New Revision: 9497

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

Log:
Clarifications on SIMPLEness.
Examples of dot calls defaulting to prefix ops.
Typo from masoch++.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSun Jun  4 16:20:16 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 3 Jun 2006
+  Last Modified: 4 Jun 2006
   Number: 3
-  Version: 36
+  Version: 37
 
 =head1 Changes to existing operators
 
@@ -33,13 +33,15 @@
 you can write C doesn't mean you can write C.)  In the
 absence of a postfix interpretation, the dot form will call the corresponding
 prefix operator instead.  So C will call C unless someone
-defines a postfix C operator.
+defines a postfix C operator.  In particular, you can say things like
+C<$array.@> and C<$filename.-e.-r>, but you can't say C<$fh.=> because
+there's a C<.=> operator already.
 
 =item * Unary C<~> now imposes a string (C) context on its
 argument, and C<+> imposes a numeric (C) context (as opposed
 to being a no-op in Perl 5).  Along the same lines, C imposes
 a boolean (C) context, and the C<[,]> list operator imposes
-an function-arguments (C) context on its arguments.
+a function-arguments (C) context on its arguments.
 Unary sigils impose the container context implied by their sigil.
 As with Perl 5, however, C<$$foo[bar]> parses as C<$($foo)[bar]>,
 so you need C<$($foo[bar])> to mean the other way.
@@ -116,9 +118,9 @@
 and imply scalar assignment:
 
 $a # simple scalar variable
-@a[SIMPLE] # single simple subscript
-%a{SIMPLE} # single simple subscript
-%a  # single literal subscript
+ANY[SIMPLE]# single simple subscript
+ANY{SIMPLE}# single simple subscript
+ANY # single literal subscript
 
 Where SIMPLE is defined as 
 
@@ -131,8 +133,8 @@
 ~TERM  # any single term coerced to string
 ?TERM  # any single term coerced to boolean
 !TERM  # any single term coerced to boolean
-@a[SIMPLE] # any of these simples used as subscript recursively
-%a{SIMPLE} # any of these simples used as subscript recursively
+ANY[SIMPLE]# any of these simples used as subscript recursively
+ANY{SIMPLE}# any of these simples used as subscript recursively
 
 We also include:
 


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

2006-06-07 Thread larry
Author: larry
Date: Wed Jun  7 08:55:55 2006
New Revision: 9528

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

Log:
putter++ notes that prec table is missing .<>


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Jun  7 08:55:55 2006
@@ -980,7 +980,7 @@
 Perl 6 has 22 precedence levels (which is fewer than Perl 5):
 
 terms   42 "eek" $x /abc/ (1+2) a(1) :by(2) .meth listop
-method postfix  . .+ .? .* .() .[] .{} .«» .:: .=
+method postfix  . .+ .? .* .() .[] .{} .<> .«» .:: .=
 autoincrement   ++ --
 exponentiation  **
 symbolic unary  ! + - ~ ? $ @ % & +^ ~^ ?^ \ ^ =


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

2006-06-07 Thread larry
Author: larry
Date: Wed Jun  7 18:51:18 2006
New Revision: 9529

Modified:
   doc/trunk/design/syn/S04.pod

Log:
Semantics of bare block clarified.


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podWed Jun  7 18:51:18 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 3 June 2006
+  Last Modified: 7 June 2006
   Number: 4
-  Version: 21
+  Version: 22
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -311,7 +311,9 @@
 therefore loop control statements.
 
 Although a bare block is no longer a do-once loop, it still executes
-immediately as in Perl 5.  If you wish to return a closure from a
+immediately as in Perl 5, as if it were immediately dereferenced with
+a C<.()> postfix, so within such a block C refers to the
+scope surrounding the block.  If you wish to return a closure from a
 function, you must use an explicit prefix such as C or C
 or C<< -> >>.  (Use of a placeholder parameter is deemed insufficiently
 explicit because it's not out front where it can be seen.  You can, of


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

2006-06-15 Thread larry
Author: larry
Date: Thu Jun 15 16:05:17 2006
New Revision: 9660

Modified:
   doc/trunk/design/syn/S04.pod

Log:
Definition of warning control exceptions.


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podThu Jun 15 16:05:17 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 7 June 2006
+  Last Modified: 15 June 2006
   Number: 4
-  Version: 22
+  Version: 23
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -473,6 +473,30 @@
 in the current sub was implicit.  For Perl 6 we have to make this
 preference explicit.)
 
+Warnings are produced in Perl 6 by throwing a resumable control
+exception to the outermost scope, which by default prints the
+warning and resumes the exception by extracting a resume continuation
+from the exception, which must be supplied by the warn() function
+(or equivalent).  Exceptions are not resumable in Perl 6 unless
+the exception object does the C role.  (Note that fatal
+exception types can do the C role even if thrown via
+C--when uncaught they just hit the outermost fatal handler
+instead of the outermost warning handler, so some inner scope has to
+explicitly treat them as warnings and resume them.)
+
+Since warnings are processed using the standard control exception
+mechanism, they may be intercepted and either suppressed or fatalized
+anywhere within the dynamic scope by supplying a suitable C
+block.  This dynamic control is orthogonal to any lexically scoped
+warning controls, which merely decide whether to call C
+in the first place.
+
+As with calls to C, the warning control exception is an
+abstraction that the compiler is free to optimize away (along with the
+associated continuation) when the compiler or runtime can determine
+that the semantics would be preserved by merely printing out the
+error and going on.
+
 =head1 The goto statement
 
 In addition to C, C, and C, Perl 6 also supports


  1   2   3   4   5   6   7   8   9   10   >