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

2006-05-12 Thread autrijus
Author: autrijus
Date: Fri May 12 18:49:49 2006
New Revision: 9222

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

Log:
* S06: Only bare keys with valid identifier names are recognized
  as named arguments:

doit when = 'now';# always a named arg
doit 'when' = 'now';  # always a positonal arg
doit 123  = 'now';# always a positonal arg
doit :123now;# always a positonal arg

* S06: Named interpolation is now always via %() in the [,] zone:

$pair = :whennow;
doit $pair,1,2,3;   # always a positional arg
doit [,] %$pair,1,2,3;  # always a named arg
doit [,] %(get_pair()),1,2,3;   # always a named arg
doit [,] %('when' = 'now'),1,2,3;  # always a named arg

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri May 12 18:49:49 2006
@@ -362,14 +362,21 @@
 doit (when = 'now'),1,2,3;# always a positional arg
 doit 'when' = 'now',1,2,3;# always a positional arg
 
+Only bare keys with valid identifier names are recognized as named arguments:
+
+doit when = 'now';# always a named arg
+doit 'when' = 'now';  # always a positonal arg
+doit 123  = 'now';# always a positonal arg
+doit :123now;# always a positonal arg
+
 Going the other way, pairs intended as named arguments that don't look
 like pairs must be introduced with the C[,] reduction operator:
 
 $pair = :whennow;
 doit $pair,1,2,3;   # always a positional arg
-doit [,] $pair,1,2,3;   # always a named arg
-doit [,]('when' = 'now'),1,2,3;# always a named arg
-doit [,] get_pair(),1,2,3;  # always a named arg
+doit [,] %$pair,1,2,3;  # always a named arg
+doit [,] %(get_pair()),1,2,3;   # always a named arg
+doit [,] %('when' = 'now'),1,2,3;  # always a named arg
 
 Note that, to apply C[,] to a single arg you may need to use parentheses.
 In general it doesn't matter.


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

2006-05-11 Thread autrijus
Author: autrijus
Date: Thu May 11 02:52:17 2006
New Revision: 9176

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

Log:
* S06: but true is now spelled as but True

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podThu May 11 02:52:17 2006
@@ -1575,7 +1575,7 @@
 sub system {
 ...
 return $error but false if $error;
-return 0 but true;
+return 0 but True;
 }
 
 Properties are predeclared as roles and implemented as mixins--see S12.


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

2006-05-02 Thread autrijus
Author: autrijus
Date: Tue May  2 05:49:59 2006
New Revision: 9099

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

Log:
* S03: Minor typographical correction, changing the
  === operator-lookalike to a more conventional
  comment.  Reported by lichtkind++

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podTue May  2 05:49:59 2006
@@ -376,9 +376,9 @@
 defines both the C[foo] reduce operator and the Cfoo 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
-... ...
+# Original  # Optimized
+$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:


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

2006-05-02 Thread autrijus
Author: autrijus
Date: Tue May  2 10:46:43 2006
New Revision: 9103

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

Log:
* S02: Clarify that subscripts evaluates under list context
   at RHS, but scalar context at LHS.  Also adds some
   example code to illustrate various interactions.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue May  2 10:46:43 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 10 Aug 2004
-  Last Modified: 1 May 2006
+  Last Modified: 2 May 2006
   Number: 2
-  Version: 36
+  Version: 37
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -589,10 +589,21 @@
 =item *
 
 The context in which a subscript is evaluated is no longer controlled
-by the sigil either.  Subscripts are always evaluated in list context
-on the assumption that slicing behavior is desired.  If you need to
-force inner context to scalar, we now have convenient single-character
-context specifiers such as + for numbers and ~ for strings.
+by the sigil either.  Subscripts are always evaluated in scalar context
+when used as a lvalue, and list context when used as a rvalue.
+
+If you need to force inner context to scalar, we now have convenient
+single-character context specifiers such as + for numbers and ~ for strings.
+Conversely, put parenthesis around the lvalue expression to force inner
+context to list:
+
+@x[f()]   = g();  # scalar context for f() and g()
+@x[f()]   = @y[g()];  # scalar context for f(), list context for g()
+@x[f()]   = @y[+g()]; # scalar context for f() and g()
+
+(@x[f()]) = g();  # list context for f() and g()
+(@x[f()]) = @y[g()];  # list context for f() and g()
+(@x[f()]) = @y[+g()]; # list context for f(), scalar context for g()
 
 =item *
 


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

2006-05-01 Thread autrijus
Author: autrijus
Date: Mon May  1 01:31:24 2006
New Revision: 9050

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

Log:
* S02: even more long dot fixes.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon May  1 01:31:24 2006
@@ -939,8 +939,9 @@
 is the variable name, including any sigil.  The package object can
 be derived from a type name by use of the C:: postfix operator:
 
-MyType. .::. .{'$foo'}
-MyType::$foo  # same thing
+MyType::$foo
+MyType.::.{'$foo'}  # same thing with dots
+MyType\ .::\ .{'$foo'}  # same thing with long dots
 
 (Directly subscripting the type with either square brackets or curlies
 is reserved for various generic type-theoretic operations.  In most other
@@ -1677,9 +1678,9 @@
 pairs.  To align values of option pairs, you may use the
 long dot postfix forms:
 
-:longkey.  .($value)
-:shortkey. .string
-:fookey.   .{ $^a = $^b }
+:longkey\  .($value)
+:shortkey\ .string
+:fookey\   .{ $^a = $^b }
 
 These will be interpreted as
 


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

2006-05-01 Thread autrijus
Author: autrijus
Date: Mon May  1 01:33:08 2006
New Revision: 9051

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

Log:
* S04: minor typo cleanup.
* S04: Document a consequence caused by the statement-terminating
   end-of-line block rule:

# Without the trailing comma, this becomes a code block
my $hash = {
1 = { 2 = 3, 4 = 5 },
};

  In other words, nested hash literals in other hash literals
  must _not_ be statement-ending. 

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon May  1 01:33:08 2006
@@ -121,7 +121,7 @@
 =head1 Statement-ending blocks
 
 A line ending with a closing brace C}, followed by nothing but
-whitespace or comments, will terminates statement if an end of statement
+whitespace or comments, will terminate a statement if an end of statement
 can occur there.  That is, these two statements are equivalent:
 
 my $x = sub { 3 }
@@ -135,6 +135,13 @@
 sub { 3 }   # the statement won't terminate here 
 ];
 
+However, a nested hash block must be disambiguated by a trailing comma:
+
+# Without the trailing comma, this becomes a code block
+my $hash = {
+1 = { 2 = 3, 4 = 5 },
+};
+
 Because subroutine declarations are expressions, not statements,
 this is now invalid:
 


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

2006-05-01 Thread autrijus
Author: autrijus
Date: Mon May  1 01:35:22 2006
New Revision: 9052

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

Log:
* S12: The example
@array.=sort
  is better written as
@array .= sort
  as it's not impossible for =sort to be a postfix operator
  on its own.

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podMon May  1 01:35:22 2006
@@ -503,7 +503,7 @@
 
 You can call an in-place mutator method like this:
 
-@array.=sort;
+@array .= sort;
 
 If there is a Cself:sort operator defined, that will be used.  Otherwise
 one will be autogenerated from the ordinary Csort operator, on the


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

2006-05-01 Thread autrijus
Author: autrijus
Date: Mon May  1 08:43:47 2006
New Revision: 9069

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

Log:
* S03: Correct the perl5ish map example to have an extra comma.
  17:44  TimToady audreyt: foo {...} 1,2,3 is wrong, needs a comma.

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podMon May  1 08:43:47 2006
@@ -698,8 +698,8 @@
 The new operators C ==  and C ==  are akin to UNIX pipes, but
 work with functions that accept and return lists.  For example,
 
- @result = map { floor($^x / 2) }
- grep { /^ \d+ $/ }
+ @result = map { floor($^x / 2) },
+ grep { /^ \d+ $/ },
@data;
 
 Can also now be written:


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

2006-05-01 Thread autrijus
Author: autrijus
Date: Mon May  1 09:18:16 2006
New Revision: 9071

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

Log:
* S06: Add Whatever to the list of Undefined types.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podMon May  1 09:18:16 2006
@@ -1311,6 +1311,7 @@
 functions.  (See S02 for how failures are handled.)
 
 Undef   Undefined (can serve as a prototype object of any class)
+WhateverWildcard (like undef, but subject to do-what-I-mean via MMD)
 Failure Failure (throws an exception if not handled properly)
 
 =head2 Immutable types


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

2006-05-01 Thread autrijus
Author: autrijus
Date: Mon May  1 10:32:02 2006
New Revision: 9076

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

Log:
* S03.pod: Retire lvalue undef and replace it with lvalue Whatever:

# Perl 5
(undef, undef, $x) = (1,2,3);

# Perl 6
(*, *, $x) = (1,2,3);

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podMon May  1 10:32:02 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 8 Mar 2004
-  Last Modified: 30 Apr 2006
+  Last Modified: 2 May 2006
   Number: 3
-  Version: 25
+  Version: 26
 
 =head1 Changes to existing operators
 
@@ -671,6 +671,8 @@
 @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)
 
 CWhatever is an undefined prototype object derived from CAny.  As a
 type it is abstract, and may not be instantiated as a defined object.


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

2006-04-30 Thread autrijus
Author: autrijus
Date: Sat Apr 29 23:39:39 2006
New Revision: 9029

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

Log:
* S06: aufrank++ pointed out the quicksort example was still
  using the (?$foo) form in Sigs instead of ($foo?).

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Apr 29 23:39:39 2006
@@ -1098,7 +1098,7 @@
 
 Instead of specifying an array parameter as an array:
 
-sub quicksort (@data, ?$reverse, ?$inplace) {
+sub quicksort (@data, $reverse?, $inplace?) {
 my $pivot := shift @data;
 ...
 }
@@ -1107,7 +1107,7 @@
 specifying the parameter as if it were an anonymous array of
 parameters:
 
-sub quicksort ([$pivot, [EMAIL PROTECTED], ?$reverse, ?$inplace) {
+sub quicksort ([$pivot, [EMAIL PROTECTED], $reverse?, $inplace?) {
 ...
 }
 


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

2006-04-29 Thread autrijus
Author: autrijus
Date: Sat Apr 29 08:27:29 2006
New Revision: 9004

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

Log:
* S02: Change the section headings Atoms and Molecules to the more
  descriptive Lexical Conventions and Whitespace and Comments.
  Reported by: Wassercrats

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Apr 29 08:27:29 2006
@@ -23,7 +23,7 @@
 These updates are not marked--if a Synopsis disagrees with its
 Apocalypse, assume the Synopsis is correct.)
 
-=head1 Atoms
+=head1 Lexical Conventions
 
 =over 4
 
@@ -71,7 +71,7 @@
 
 =back
 
-=head1 Molecules
+=head1 Whitespace and Comments
 
 =over 4
 


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

2006-04-26 Thread autrijus
Author: autrijus
Date: Wed Apr 26 09:36:05 2006
New Revision: 8957

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

Log:
* S02: Explicitly define how Ps/Pe and BidiMirroring
   characters match, and resolve the one-to-many
   open/closing mapping by preferring the lower
   codepoint.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr 26 09:36:05 2006
@@ -51,9 +51,17 @@
 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
+However, bidirectional mirroring characters with no corresponding
+closing characters does not qualify as opening brackets.
+
+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.)
+since they're bidirectional but not in the Ps/Pe set.
+
+The CU+301D has two closing alternatives, CU+301E and CU+301F;
+Perl 6 only recognizes the one with lower code point number, CU+301E,
+as the closing brace.  This policy also applies to new one-to-many
+mappings introduced in the future.
 
 =back
 


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

2006-04-26 Thread autrijus
Author: autrijus
Date: Wed Apr 26 10:05:19 2006
New Revision: 8961

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

Log:
* Further note that Ps/Pe dominates BidiMirroring, so U+298D
  maps to U+298E, and U+298E itself does not open brackets.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr 26 10:05:19 2006
@@ -52,19 +52,23 @@
 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.
+
 Characters with no corresponding closing characters does not qualify
 as opening brackets.  This includes the second section of the BidiMirroring
 data table, as well as CU+201A and CU+201E.
 
+If a character is already used in Ps/Pe mappings, then its entry in
+BidiMirroring is ignored.  Therefore CU+298D maps to CU+298E,
+not CU+2990, and CU+298E itself is not a valid bracket opener.
+
 The CU+301D has two closing alternatives, CU+301E and CU+301F;
 Perl 6 only recognizes the one with lower code point number, CU+301E,
 as the closing brace.  This policy also applies to new one-to-many
 mappings introduced in the future.
 
-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


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

2006-04-26 Thread autrijus
Author: autrijus
Date: Wed Apr 26 10:07:38 2006
New Revision: 8962

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

Log:
* S02: bump version from the unicode change; also merge in
   azuroth++'s typo fix, as well as paragraph reflow.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr 26 10:07:38 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 10 Aug 2004
-  Last Modified: 25 Apr 2006
+  Last Modified: 26 Apr 2006
   Number: 2
-  Version: 33
+  Version: 34
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1591,18 +1591,19 @@
 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 the unrecognized subroutine name 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 Cfoo:
+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 Cfoo:
 
 foo.bar# foo().bar -- postfix prevents args
 foo .bar   # foo($_.bar)   -- no postfix starts with whitespace
@@ -1636,12 +1637,13 @@
 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 Cever parsed as an indirect object,
-but that form will Calways be parsed as an indirect object regardless
-of whether the identifier is otherwise declared.
+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 Cever parsed as an indirect object, but that form
+will Calways be parsed as an indirect object regardless of whether
+the identifier is otherwise declared.
 
 =item *
 


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

2006-04-25 Thread autrijus
Author: autrijus
Date: Tue Apr 25 08:48:59 2006
New Revision: 8941

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

Log:
* S03: Cleanups.
* There's no $s xxx postfix form anymore -- write $s xx *.
* @a === @a is sufficient to illustrate the reference-identity point,
  not [EMAIL PROTECTED] === [EMAIL PROTECTED].  (Although the latter is also 
true.)
* Change the two occurrence of LSynopsis X to S0X to agree with the
  rest of the text and other specs.  Also capitalize Synopses.
* Spell out the ASCII equivalent of infix zip as Y.
* Update code examples to reflect long dot.

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podTue Apr 25 08:48:59 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 8 Mar 2004
-  Last Modified: 22 Apr 2006
+  Last Modified: 25 Apr 2006
   Number: 3
-  Version: 21
+  Version: 22
 
 =head1 Changes to existing operators
 
@@ -51,8 +51,7 @@
 
 =item * Cx splits into two operators: Cx (which concatenates repetitions 
 of a string to produce a single string), and Cxx (which creates a list of 
-repetitions of a list or scalar).  Conjecture: the Cxxx infix operator
-takes no right argument and is equivalent to Cxx Inf.
+repetitions of a list or scalar).
 
 =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=.
@@ -118,7 +117,7 @@
 tests whether they are the same value (eg. C1 === 1); for two reference
 types, checks whether they have the same identity value.  For reference
 types that do not define an identity, the reference itself is used (eg. it
-is not true that C[1,2] === [1,2], but it is true that C[EMAIL PROTECTED] 
=== [EMAIL PROTECTED]).
+is not true that C[1,2] === [1,2], but it is true that C@a === @a).
 
 Any reference type may pretend to be a value type by defining a C.id method
 which returns a built-in value, i.e. an immutable object or a native value,
@@ -148,7 +147,7 @@
 
 =item * C=~ becomes the smart match operator C~~, with a whole new set
 of semantics.  Anywhere you used C=~ before you now use C~~, but C~~ is
-much more general now.  See LSynopsis 4 for details.  (To catch brainos,
+much more general now.  See S04 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~~ or C~= 
instead,
 or to put a space between if they really wanted to assign a stringified value.)
@@ -578,7 +577,7 @@
 rule foo
 token foo
 
-These all have their uses and are explained in subsequent synopses.
+These all have their uses and are explained in subsequent Synopses.
 
 =head1 Argument List Interpolating
 
@@ -658,8 +657,8 @@
 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
+@slice = %x{*;'foo'};  # any keys in domain of 1st dimension
+@array[*]  # flattens, unlike @array[]
 
 CWhatever is an undefined prototype object derived from CAny.  As a
 type it is abstract, and may not be instantiated as a defined object.
@@ -703,7 +702,7 @@
  == grep { /^ \d+ $/ }
  == @data;
 
-Either form more clearly indicates the flow of data.  See LSynopsis 6 for 
+Either form more clearly indicates the flow of data.  See S06 for 
 more of the (less-than-obvious) details on these two operators.
 
 =head1 Invocant marker
@@ -729,7 +728,8 @@
 print Name: $name;   Zip code: $zip\n;
 }
 
-Czip has an infix synonym, the Unicode operator C¥.
+Czip has an infix synonym, the Unicode operator C¥, and its the ASCII
+equivalent CY.
 
 To read arrays in parallel like Czip but just sequence the values
 rather than generating tuples, use Ceach instead of Czip.
@@ -766,12 +766,12 @@
 }
 while 0  $i { $i++ }
 
-It is, however, still possible to align accessors by explicitly using the C.
-operator:
+It is, however, still possible to align accessors by explicitly using the
+Ilong dot syntax:
 
  %monsters.{'cookie'} = Monster.new;
- %people  .{'john'}   = Person .new;
- %cats.{'fluffy'} = Cat.new;
+ %people. .{'john'}   = Person.new;
+ %cats.   .{'fluffy'} = Cat.new;
 
 =head1 Precedence
 


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

2006-04-25 Thread autrijus
Author: autrijus
Date: Tue Apr 25 09:03:00 2006
New Revision: 8942

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

Log:
* S02, 03, 04, 06: Remove all occurrence of tuple and replace
  it with Seq.  A Seq is simply a List with no laz
  y parts (such as Range objects) in it:

(1,2,3); # Seq


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue Apr 25 09:03:00 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 10 Aug 2004
-  Last Modified: 24 Apr 2006
+  Last Modified: 25 Apr 2006
   Number: 2
-  Version: 32
+  Version: 33
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -627,11 +627,11 @@
 :(Any Num Dog|Cat $numdog)
 
 Such a signature may be used within another signature to apply
-additional type constraints.  When applied to a tuple argument, the
+additional type constraints.  When applied to a CCapture argument, the
 signature allows you to specify the types of parameters that would
 otherwise be untyped:
 
-:(Any Num Dog|Cat $numdog, MySig *$a ($i,$j,$k,$mousestatus))
+:(Any Num Dog|Cat $numdog, MySig \$a ($i,$j,$k,$mousestatus))
 
 =item *
 

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podTue Apr 25 09:03:00 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 25 Apr 2006
   Number: 3
-  Version: 22
+  Version: 23
 
 =head1 Changes to existing operators
 
@@ -722,7 +722,8 @@
 =head1 Czip
 
 In order to support parallel iteration over multiple arrays, Perl 6 has
-a Czip function that builds tuples of the elements of two or more arrays.
+a Czip function that builds CSeq objects from the elements of two or more
+arrays.
 
 for zip(@names; @codes) - [$name, $zip] {
 print Name: $name;   Zip code: $zip\n;

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podTue Apr 25 09:03:00 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 19 Aug 2004
-  Last Modified: 21 Apr 2006
+  Last Modified: 25 Apr 2006
   Number: 4
-  Version: 17
+  Version: 18
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -226,8 +226,8 @@
 
 for each(@a;@b) - $a, $b { print [$a, $b]\n }
 
-or use the Czip function to generate a list of tuples that each can be bound
-to multiple arguments enclosed in square brackets:
+or use the Czip function to generate a list of CSeq objects that each can
+be bound to multiple arguments enclosed in square brackets:
 
 for zip(@a;@b) - [$a, $b] { print [$a, $b]\n }
 

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podTue Apr 25 09:03:00 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 21 Mar 2003
-  Last Modified: 22 Apr 2006
+  Last Modified: 25 Apr 2006
   Number: 6
-  Version: 30
+  Version: 31
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1196,7 +1196,7 @@
 my ($i, $j, $k);
 @a ~~ rx/
, # match initial elem boundary
-   :(Int $i,Int $j,Int? $k)# match tuple with 2 or 3 ints
+   :(Int $i,Int $j,Int? $k)# match lists with 2 or 3 ints
, # match final elem boundary
  /;
 say i = $i;
@@ -1209,7 +1209,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 tuple, or match as
+within the signature to specify the type of the signature, or match as
 an arglist:
 
 :(Num, Num -- Coord)
@@ -1225,7 +1225,7 @@
 
 :(\Dog())
 
-that is, match a null tuple of type CDog.  Nor is it equivalent to
+that is, match a nullary function of type CDog.  Nor is it equivalent to
 
 :(Dog)
 
@@ -1233,11 +1233,7 @@
 
 :(\Any(Dog))
 
-or
-
-:([Dog])
-
-and match a tuple-ish item with a single value of type Dog.
+and match a function taking a single value of type Dog.
 
 Note also that bare C\(1,2,3) is never legal in a regex since the
 first paren would try to match literally.


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

2006-04-25 Thread autrijus
Author: autrijus
Date: Tue Apr 25 09:37:36 2006
New Revision: 8943

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

Log:
* S02: Cleanup provisional-call text a bit, adding some more
   examples, and note that method calls are never provisional
   and cannot be invalidated.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue Apr 25 09:37:36 2006
@@ -1546,15 +1546,24 @@
 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
-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 CCHECK time.
+You still must declare your subroutines, but a bareword with an unrecognized
+name is provisionally compiled as a subroutine call, on that assumption that
+such a declaration will occur by the end of the current compilation unit:
+
+foo; # provisional call if neither foo nor ::foo is defined so far
+foo();   # provisional call if foo is not defined so far
+foo($x, $y); # provisional call if foo is not defined so far
+$x.foo;  # not a provisional call; it's a method call on $x
+foo($x); # not a provisional call; it's a method call on $x
+
+If a postdeclaration is not seen, the compile fails at CCHECK 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
+call.
+
+This fixup is done only for provisional calls.  If there
 is Iany 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,
@@ -1563,9 +1572,10 @@
 since that's a run-time dispatch, and all multis are effectively
 visible at the point of the controlling Cproto 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.
+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.
 
 If the unrecogized subname is followed by C postcircumfix:( ) , it is
 compiled as a provisional function call of the parenthesized form.


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

2006-04-23 Thread autrijus
Author: autrijus
Date: Sun Apr 23 08:02:50 2006
New Revision: 8917

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

Log:
* S02: The *() form now means *($/).
* Clarified that $() etc are term-level macros. 

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSun Apr 23 08:02:50 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 10 Aug 2004
-  Last Modified: 22 Apr 2006
+  Last Modified: 23 Apr 2006
   Number: 2
-  Version: 29
+  Version: 30
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -603,8 +603,9 @@
 
 All prefix sigil operators accept one positional argument, evaluated in
 scalar context as a rvalue.  They can interpolate in strings if called with
-parentheses.  The C$(), C@() and C%() forms defaults to C$/ as the
-implicit argument.
+parentheses.  The special syntax form C$() translates into C$( $/ ) 
+to operate on the current match object; the same applies to C@(), C%() and
+C*() forms.
 
 CCapture objects fill the ecological niche of references in Perl 6.
 You can think of them as fat references, that is, references that


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

2006-04-23 Thread autrijus
Author: autrijus
Date: Sun Apr 23 09:07:38 2006
New Revision: 8918

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

Log:
* S04: the stop-parsing-on-bare-block rule for conditionals:
if -e { say exists } { extra() }

  has also to stop parsing on pointies:
if -e - $x { say exists } { extra() }


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podSun Apr 23 09:07:38 2006
@@ -623,22 +623,25 @@
 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 Imust 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
+a bare block or pointy block that would be misinterpreted as the statement's
+block.  This is regardless of whether a term or operator is expected where
+the 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() }
+if -e - $x { say exists } { extra() }
 
 is always parsed as
 
 if (-e) { say exists }; { extra() }
+if (-e) - $x { say exists }; { extra() }
 
 rather than
 
 if (-e { say exists }) { extra() }
+if (-e (- $x { 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


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

2006-04-22 Thread autrijus
Author: autrijus
Date: Sat Apr 22 00:22:21 2006
New Revision: 8908

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

Log:
* S03: Document that Clet and Ctemp forms are not declarators.

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Apr 22 00:22:21 2006
@@ -535,6 +535,10 @@
 a function, except that, unlike in a function call, the parameters
 are bound Crw by default rather than Creadonly.  See Binding below.
 
+Note that Ctemp and Clet are Inot 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.
+
 There are a number of other declarators that are not variable
 declarators.  These include both type declarators:
 


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

2006-04-22 Thread autrijus
Author: autrijus
Date: Sat Apr 22 03:04:09 2006
New Revision: 8909

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

Log:
* S03: Clarify that C* does not really provide list
   context to its operand; rather, it injects the
   operand to the currnent argument.

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Apr 22 03:04:09 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 8 Mar 2004
-  Last Modified: 21 Apr 2006
+  Last Modified: 22 Apr 2006
   Number: 3
-  Version: 19
+  Version: 20
 
 =head1 Changes to existing operators
 
@@ -28,12 +28,13 @@
 =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.   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 * Unary C~ now imposes a string (CStr) context on its argument, and
+C+ imposes a numeric (CNum) context (as opposed to being a no-op in Perl
+5).  Along the same lines, C? imposes a boolean (CBool) context, and C*
+imposes an function-arguments (CCapture) 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
@@ -561,19 +562,20 @@
 
 These all have their uses and are explained in subsequent synopses.
 
-=head1 Flattening
+=head1 Argument List Interpolating
 
-Since typeglobs are being removed, unary C* may now serve as a
-general-purpose flattening operator.  It can be used to flatten an
-Array or Hash into the current call's argument list (as positional
-and named arguments respectively), usually to allow their contents to be used
-as the arguments of a subroutine call.
+Since typeglobs are being removed, unary C* may now serve as an
+interpolator, by casting its single operand to a CCapture object
+and insert it into the current argument list.
+
+It can be used to interpolate an CArray or CHash into the current
+call, as positional and named arguments respectively.
 
 Note that those arguments still must comply with the subroutine's
 signature, but the presence of C* defers that test until run time for
 that argument (and for any subsequent arguments):
 
-my @args = ([EMAIL PROTECTED], @bar);
+my @args = (scalar @foo, @bar);
 push [EMAIL PROTECTED];
 
 is equivalent to:
@@ -597,6 +599,11 @@
 push @foo, @$bar;
 push @foo, $bar[];
 
+The first form works by interpolating C$bar's elements into positional
+arguments to Cpush.  The last two forms works because the slurpy
+array in Cpush's signature flattens the CArray object in positional
+argument.
+
 Note that the last two forms also allow you to specify list context on
 assignment:
 
@@ -614,9 +621,13 @@
 not to mention the C  , C . , C«», and C.«»
 constant and interpolating slice subscripting forms.
 
-The C* operator flattens lazily.  To get an immediate flattening like
-Perl 5 does, use unary C** instead.  You may use either of them on
-a scalar iterator to force it to iterate.
+The C* operator interpolates lazily for CArray and CRange objects.
+To get an immediate interpolation like Perl 5 does, use unary C** instead:
+
+func(*(1..Inf));# works fine
+func(**(1..Inf));   # never terminates
+
+You may use either of them on a scalar iterator to force it to iterate.
 
 =head1 Piping operators
 


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

2006-04-21 Thread autrijus
Author: autrijus
Date: Thu Apr 20 23:49:15 2006
New Revision: 8893

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

Log:
Stylistic cleanup of S05; no functional changes.

* s/TimToady/Larry Wall/

* Consistently change foo to Cfoo or Ifoo to be consistent
  with context.

* Fixed the state $x ||= /.../ example, which will cause rematch
  on matchfail.  state $x //= /.../ would be the correct form.

* Clarified that only Int or Range objects can sensibly be used
  as quantifier range; matching something 3.5+6i times wouldn't
  quite make sense.


Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podThu Apr 20 23:49:15 2006
@@ -11,16 +11,17 @@
 
 =head1 VERSION
 
-   Maintainer: Patrick Michaud [EMAIL PROTECTED] ( TimToady)
+   Maintainer: Patrick Michaud [EMAIL PROTECTED] and
+   Larry Wall [EMAIL PROTECTED]
Date: 24 Jun 2002
Last Modified: 20 Apr 2006
Number: 5
-   Version: 17
+   Version: 18
 
 This document summarizes Apocalypse 5, which is about the new regex
-syntax.  We now try to call them regex because they haven't been
+syntax.  We now try to call them Iregex because they haven't been
 regular expressions for a long time.  When referring to their use in
-a grammar, the term rule is preferred.
+a grammar, the term Irule is preferred.
 
 =head1 New match state and capture variables
 
@@ -126,7 +127,7 @@
 
 Since this is implicitly anchored to the position, it's suitable for
 building parsers and lexers.  The pattern you supply to a Perl macro's
-is parsed trait has an implicit C:p modifier.
+Cis parsed trait has an implicit C:p modifier.
 
 Note that
 
@@ -266,7 +267,7 @@
 
 =item *
 
-The new C:rw modifier causes this regex to claim the current
+The new C:rw modifier causes this regex to Iclaim 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
@@ -394,8 +395,8 @@
 
 =item *
 
-C. matches an anything, while C\N matches an anything except
-newline. (The C/s modifier is gone.)  In particular, C\N matches
+C. matches an Ianything, while C\N matches an Ianything except
+newline. (The C/s modifier is gone.)  In particular, C\N matches
 neither carriage return nor line feed.
 
 =item *
@@ -451,7 +452,7 @@
 The repetition specifier is now C**{...} for maximal matching,
 with a corresponding C**{...}? for minimal matching.  Space is
 allowed on either side of the asterisks.  The curlies are taken to
-be a closure returning a number or a range.
+be a closure returning an Int or a Range object.
 
  / value was (\d ** {1..6}?) with ([\w]**{$m..$n}) /
 
@@ -459,7 +460,7 @@
 
  / [foo]**{1,3} /
 
-(At least, it fails in the absence of Cuse rx :listquantifier,
+(At least, it fails in the absence of Cuse rx :listquantifier,
 which is likely to be unimplemented in Perl 6.0.0 anyway).
 
 The optimizer will likely optimize away things like C**{1...}
@@ -471,7 +472,7 @@
 
 =item *
 
-C ...  are now extensible metasyntax delimiters or assertions
+C ...  are now extensible metasyntax delimiters or Iassertions
 (i.e. they replace Perl 5's crufty C(?...) syntax).
 
 =back
@@ -486,7 +487,7 @@
 
 =item *
 
-Instead they're passed raw to the regex engine, which can then decide
+Instead they're passed Iraw to the regex engine, which can then decide
 how to handle them (more on that below).
 
 =item *
@@ -520,7 +521,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
 as a subrule.  As with scalar subrules, a tainted subrule always fails.
-All values pay attention to the current C:ignorecase setting
+All values pay attention to the current C:ignorecase setting.
 
 =item *
 
@@ -539,7 +540,7 @@
 
 If the value is a string, it is matched literally, starting after where
 the key left off matching.  As a natural consequence, if the value is
-, nothing special happens except that the key match succeeds.
+C, nothing special happens except that the key match succeeds.
 
 =item *
 
@@ -669,7 +670,7 @@
 internally that turns into a hash lookup.)
 
 As with bare hash, the longest key matches according to the venerable
-longest token rule, but in addition, you may combine multiple hashes
+Ilongest token rule, but in addition, you may combine multiple hashes
 under the same longest-token consideration like this:
 
 %statement|%prefix|%term
@@ -761,10 +762,10 @@
 
 / after foo \d+ before bar /
 
-except that the scan for foo can be done in the forward direction,
+except that the scan for Cfoo can be done in the forward direction,
 while a lookbehind assertion would presumably scan for C\d+ and then
 match Cfoo backwards.  The use of C (...)  affects only the
-meaning of the result object and the positions

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

2006-04-21 Thread autrijus
Author: autrijus
Date: Fri Apr 21 08:56:22 2006
New Revision: 8899

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

Log:
* S05: Oops, turns out I entirely read perlop.pod incorrectly;
  it matches once only means it matches successfully once only,
  not it performs the match once only.  Sorry, TimToady++'s
  original example of:

(state $x) ||= / pattern /; 

  was correct.

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podFri Apr 21 08:56:22 2006
@@ -1066,9 +1066,9 @@
 The Perl 5 C?...? syntax (Imatch once) was rarely used and can be
 now emulated more cleanly with a state variable:
 
-(state $x) //= / pattern /;# only matches first time
+(state $x) ||= / pattern /;# only matches first time
 
-To reset the pattern, simply say Cundefine $x.
+To reset the pattern, simply say C$x = 0.
 
 =back
 


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

2006-04-19 Thread autrijus
Author: autrijus
Date: Wed Apr 19 06:01:46 2006
New Revision: 8877

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

Log:
* S06: two trivial syntax typos.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podWed Apr 19 06:01:46 2006
@@ -779,7 +779,7 @@
 argument list becomes a zero-dimensional slice.  It differs from
 C\() in several ways:
 
-sub foo (@;slices) {...}
+sub foo (*@;slices) {...}
 foo;# +@;slices == 0
 foo();  # +@;slices == 1
 
@@ -1188,9 +1188,9 @@
 to indicate a signature.  Otherwise you must at least put the sigil of
 the variable, or we can't correctly differentiate:
 
-my Dog ($fido, $spot) = twodogs(); # list of two dogs
+my Dog ($fido, $spot)   := twodogs();  # list of two dogs
 my Dog $ ($fido, $spot) := twodogs();  # one twodog object
-my Dog :($fido, $spot) := twodogs();   # one twodog object
+my Dog :($fido, $spot)  := twodogs();  # one twodog object
 
 Subsignatures can be matched directly with rules by using C:(...)
 notation.


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

2006-04-17 Thread autrijus
Author: autrijus
Date: Mon Apr 17 08:52:55 2006
New Revision: 8741

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

Log:
* S04: Capture ~~ Signature can test for bindableness.

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon Apr 17 08:52:55 2006
@@ -764,6 +764,7 @@
 Array   .[number] array element truth* match if $_[number]
 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 Codesimple closure truth*match if $x() (ignoring $_)
 Any Class class membership match if $_.does($x)
 Any Role  role playing match if $_.does($x)


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

2006-04-17 Thread autrijus
Author: autrijus
Date: Mon Apr 17 20:39:37 2006
New Revision: 8765

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

Log:
* S06: Clarified multidimensional Capture part by stating
  that only the positional/named parts gets into *@;x, and
  the invocant is exempt from it.  This allows for method
  calls that takes multiple slices, such as $moose.zip(1;2;3)
  in addition to zip(1;2;3).

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podMon Apr 17 20:39:37 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 21 Mar 2003
-  Last Modified: 15 Apr 2006
+  Last Modified: 18 Apr 2006
   Number: 6
-  Version: 24
+  Version: 25
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -744,11 +744,11 @@
 
 =head2 Multidimensional argument list binding
 
-Some functions take more than one CCapture as their argument list, that they
-wish not to be flattened into one list.  For instance, Czip() wants to
-iterate several lists in parallel, while array and hash subscripts want to
-process multidimensional slices.  The set of underlying argument list (Capture)
-objects may be bound to a single array parameter declared with a C; twigil:
+Some functions take more than one lists of positional and/or named arguments,
+that they wish not to be flattened into one list.  For instance, Czip() wants
+to iterate several lists in parallel, while array and hash subscripts want to
+process multidimensional slices.  The set of underlying argument lists may be
+bound to a single array parameter declared with a C; twigil:
 
 sub foo (*@;slices) { ... }
 
@@ -768,6 +768,11 @@
 
 sub foo (*@;slices -- Num) { ... }
 
+The invocant does not participate in multi-dimensional argument lists,
+so Cself is not present in any of the C@;slices below:
+
+method foo (*@;slices) { ... }
+
 =head2 Zero-dimensional argument list
 
 If you call a function without parens and supply no arguments, the


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

2006-04-16 Thread autrijus
Author: autrijus
Date: Sun Apr 16 18:24:04 2006
New Revision: 8724

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

Log:
* more typo cleanups promted by Dr. Ruud.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSun Apr 16 18:24:04 2006
@@ -705,7 +705,7 @@
 
 =head2 Flattening argument lists
 
-The unary prefix operator C* casts a value to an CCapture
+The unary prefix operator C* casts a value to a CCapture
 object, then splices it into the argument list it occurs in.
 
 Casting CCapture to CCapture is a no-op:

Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podSun Apr 16 18:24:04 2006
@@ -697,7 +697,7 @@
 my $val := %hashfoobar;
 
 my @array;
-my $ref = [EMAIL PROTECTED]; # $ref is an Capture object - see S02
+my $ref = [EMAIL PROTECTED]; # $ref is a Capture object - see S02
 
 my %hash;
 %hashfoobar = foo; # duh


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

2006-04-15 Thread autrijus
Author: autrijus
Date: Sat Apr 15 06:17:49 2006
New Revision: 8698

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

Log:
* Synopses: Change Arguments to Capture to avoid using a
  plural word as a class name.  (Also it makes it easier later
  to say that Match is a subclass of Capture.)

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Apr 15 06:17:49 2006
@@ -525,35 +525,33 @@
 
 =item *
 
-An argument list object (CArguments) may be created with backslashed parens:
+An argument list object (CCapture) may be created with backslashed parens:
 
 $args = \(1,2,3,:miceblind)
 
-Values in CArguments values are parsed as ordinary expressions, marked as
-positional, named, to-be-flattened, and so on.
+Values in CCapture are parsed as ordinary expressions, marked as invocant,
+positional, named, and so on.
 
-Like CList objects, CArguments are immutable in the abstract, but
-evaluates its arguments lazily.  Before everything inside a CArguments are
+Like CList objects, CCapture objects are immutable in the abstract, but
+evaluates its arguments lazily.  Before everything inside a CCapture are
 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
 that we have the promise to make the bits of it immutable as they become known.
 
-CArguments objects may contain multiple unresolved iterators such as pipes
+CCapture objects may contain multiple unresolved iterators such as pipes
 or slices.  How these are resolved depends on what they are eventually
 bound to.  Some bindings are sensitive to multiple dimensions while
 others are not.
 
-You may cast CArguments to other types with a prefix sigil operator:
+You may retrieve parts from a CCapture object with a prefix sigil operator:
 
 $args = \3; # same as $args = \(3)
 $$args; # same as $args as Scalar or Scalar($args)
 @$args; # same as '$args as Array  or Array($args)
 %$args; # same as '$args as Hash   or Hash($args)
-$args; # same as '$args as Code   or Code($args)
 
 When cast into an array, you can access all the positional arguments; into a
-hash, all named arguments; into a scalar, the invocant; into code, its slurpy
-nameless block.
+hash, all named arguments; into a scalar, its invocant.
 
 All prefix sigil operators accept one positional argument, evaluated in
 scalar context as a rvalue.  They can interpolate in strings if called with

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSat Apr 15 06:17:49 2006
@@ -61,7 +61,7 @@
 =item * The backslash operator captures its arguments, and returns an
 object representing those arguments.  You can Idereference this object
 in several ways to retrieve different parts of the arguments; see the
-definition of CArguments S02 for details.
+definition of CCapture in S02 for details.
 
 =item * The old scalar C.. flipflop operator is now done with
 Cff operator.  (C.. now always produces a Range object
@@ -456,7 +456,7 @@
 
 as is this:
 
-my $args = \(@foo, @bar);# construct Arguments object
+my $args = \(@foo, @bar);# construct a Capture object
 push *$args;
 
 In list context, a Scalar holding an Array object does not flatten.  Hence

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Apr 15 06:17:49 2006
@@ -403,7 +403,7 @@
 pairs instead of values.)
 
 Pair constructors are recognized syntactically at the call level and
-put into the named slot of the CArguments structure.  Hence they may be
+put into the named slot of the CCapture structure.  Hence they may be
 bound to positionals only by name, not as ordinary positional CPair
 objects.  Leftover named arguments can be slurped into a slurpy hash.
 
@@ -579,7 +579,7 @@
 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
+Capture 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:
@@ -681,13 +681,13 @@
 
 =head2 Argument list binding
 
-The underlying CArguments object may be bound to a single scalar
+The underlying CCapture object may be bound to a single scalar
 parameter marked with a C\.
 
 sub

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

2006-04-06 Thread autrijus
Author: autrijus
Date: Thu Apr  6 01:12:52 2006
New Revision: 8593

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

Log:
* S02/S13: s/casted/cast/, as suggested by Uri.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Apr  6 01:12:52 2006
@@ -500,11 +500,11 @@
 
 =item *
 
-In numeric context (i.e. when casted into CInt or CNum), a Hash object
+In numeric context (i.e. when cast into CInt or CNum), a Hash object
 becomes the number of pairs contained in the hash.  In a boolean context, a
 Hash object is true if there are any pairs in the hash.  In either case,
 any intrinsic iterator would be reset.  (If hashes do carry an intrinsic
-iterator (as they do in Perl 5), there will be a C.reset method on the h
+iterator (as they do in Perl 5), there will be a C.reset method on the
 hash object to reset the iterator explicitly.)
 
 =item *

Modified: doc/trunk/design/syn/S13.pod
==
--- doc/trunk/design/syn/S13.pod(original)
+++ doc/trunk/design/syn/S13.podThu Apr  6 01:12:52 2006
@@ -120,7 +120,7 @@
 =head1 Type Casting
 
 A class can use the C *infix:as  submethod to declare that its objects
-can be casted to some other class:
+can be cast to some other class:
 
 multi submethod *infix:as (IO)  { $*OUT }
 multi submethod *infix:as (Int) { 1 }


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

2006-04-06 Thread autrijus
Author: autrijus
Date: Thu Apr  6 01:29:34 2006
New Revision: 8594

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

Log:
* More grammar nits, from Daniel Hulme

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podThu Apr  6 01:29:34 2006
@@ -219,10 +219,10 @@
 
 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.
+If this multi-dispatch succeeds, the result becomes the result of the
+reduce.
 
-Otherwise, if the MMD dispatch fails, then if there is one argument,
+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


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

2006-04-05 Thread autrijus
Author: autrijus
Date: Wed Apr  5 18:36:02 2006
New Revision: 8567

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

Log:
* Prefix sigil casters $ @ %  now joins the other prefix
  unary operators, such as \ ~ + *, on the 4th level of
  precedence table.

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Apr  5 18:36:02 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 5 Apr 2006
   Number: 3
-  Version: 16
+  Version: 17
 
 =head1 Operator renaming
 
@@ -546,7 +546,7 @@
 method postfix  . .+ .? .* .() .[] .{} .«» .=
 autoincrement   ++ --
 exponentiation  **
-symbolic unary  ! + - ~ ? * ** +^ ~^ ?^ \ ^
+symbolic unary  ! + - ~ ? $ @ %  * ** +^ ~^ ?^ \ ^
 multiplicative  * / % x xx + + + ~ ~ ~
 additive+ - ~ +| +^ ~| ~^
 junctive and (all)  


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

2006-04-05 Thread autrijus
Author: autrijus
Date: Wed Apr  5 18:59:00 2006
New Revision: 8568

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

Log:
* S03: Excise the reference word; array reference is now
   simply Array objects, and prefix * can flatten hashes
   as well as arrays.

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podWed Apr  5 18:59:00 2006
@@ -55,13 +55,13 @@
 For those still living without the blessings of Unicode, that can also be
 written: C  ...  .
 
-=item * The scalar comma C, now constructs a List reference of its
+=item * The scalar comma C, now constructs a List object from its
 operands.  You have to use a C[-1] subscript to get the last one.
 
-=item * The backslash operator still produces a reference, but when
-applied to a parenthesized list, produces a List object (an arglist)
-instead of a list of refs.  (According to the previous item, in scalar
-context the backslash is redundant, but is good documentation anyway.)
+=item * The backslash operator captures its arguments, and returns an
+object representing those arguments.  You can Idereference this object
+in several ways to retrieve different parts of the arguments; see the
+definition of CArguments S02 for details.
 
 =item * The old scalar C.. flipflop operator is now done with
 Cff operator.  (C.. now always produces a Range object
@@ -189,7 +189,7 @@
 Note that method calls are really postfix operators, not infix, so you
 shouldn't put a C« after the dot.
 
-Hyper operators are defined recursively on array references, so:
+Hyper operators are defined recursively on arrays, so:
 
 -« [[1, 2], 3]   #[-«[1, 2], -«3]
  # == [[-1, -2], -3]
@@ -390,15 +390,17 @@
 are bound to the same underlying variable.  C$x =:= $y would return
 true in the above example.
 
-=head1 List flattening
+=head1 Flattening
 
 Since typeglobs are being removed, unary C* may now serve as a
-lazy list flattening operator.  It is used to flatten an Array
-(or List) into the List being constructed for the current call,
-usually to allow the array's contents to be used as the arguments of
-a subroutine call.  Note that those arguments still must comply with
-the subroutine's signature, but the presence of C* defers that test
-until run time for that argument (and for any subsequent arguments):
+general-purpose flattening operator.  It can be used to flatten an
+Array or Hash into the current call's argument list (as positional
+and named arguments respectively), usually to allow their contents to be used
+as the arguments of a subroutine call.
+
+Note that those arguments still must comply with the subroutine's
+signature, but the presence of C* defers that test until run time for
+that argument (and for any subsequent arguments):
 
 my @args = ([EMAIL PROTECTED], @bar);
 push [EMAIL PROTECTED];
@@ -409,26 +411,24 @@
 
 as is this:
 
-my $args = \(@foo, @bar);# construct List object
+my $args = \(@foo, @bar);# construct Arguments object
 push *$args;
 
-In list context, a scalar reference to an array does not flatten.  Hence
+In list context, a Scalar holding an Array object does not flatten.  Hence
 
 $bar = @bar;
 push @foo, $bar;
 
-merely pushes a single scalar reference onto C@foo.  You can
-explicitly flatten it in any of these ways:
+merely pushes a single Array object onto C@foo.  You can explicitly flatten
+it in any of these ways:
 
 push @foo, *$bar;
 push @foo, @$bar;
 push @foo, $bar[];
 
-(The C* in list context doesn't change the call semantics as it
-does in scalar context.)  Note that these three forms also allow you
-to specify list context on assignment:
+Note that the last two forms also allow you to specify list context on
+assignment:
 
-*$bar = (1,2,3);
 @$bar = (1,2,3);
 $bar[] = (1,2,3);
 


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

2006-04-05 Thread autrijus
Author: autrijus
Date: Wed Apr  5 19:08:28 2006
New Revision: 8569

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

Log:
* S02/S05: Excise reference from them.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr  5 19:08:28 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 10 Aug 2004
-  Last Modified: 1 Apr 2006
+  Last Modified: 6 Apr 2006
   Number: 2
-  Version: 19
+  Version: 20
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -326,13 +326,13 @@
 
 Sigils are now invariant.  C$ always means a scalar variable, C@
 an array variable, and C% a hash variable, even when subscripting.
-Array and hash variable names in scalar context automatically produce
-references.
+Variables such as C@array and C%hash in scalar context simply
+returns themselves Array and Hash objects.
 
 =item *
 
-In string contexts container references automatically dereference
-to appropriate (white-space separated) string values.  In numeric
+In string contexts, container objects automatically stringify to
+appropriate (white-space separated) string values.  In numeric
 contexts, the number of elements in the container is returned.
 In boolean contexts, a true value is returned if and only if there
 are any elements in the container.
@@ -354,7 +354,7 @@
 
 =item *
 
-Subscripts now consistently dereference the reference produced by
+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
 Bdot form of each subscript (C@foo.[1] and C%bar.{'a'}) which
@@ -380,9 +380,9 @@
 There is a need to distinguish list assignment from list binding.
 List assignment works exactly as it does in Perl 5, copying the
 values.  There's a new C:= binding operator that lets you bind
-names to array and hash references without copying, just as subroutine
-arguments are bound to formal parameters.  See S06 for more about
-parameter binding.
+names to Array and Hash objects without copying, in the same way
+as subroutine arguments are bound to formal parameters.  See S06
+for more about parameter binding.
 
 =item *
 
@@ -442,12 +442,11 @@
 
 =item *
 
-Unlike in Perl 5, the notation Cfoo merely creates a reference
-to function Cfoo without calling it.  Any function reference may
-be dereferenced and called using parens (which may, of course,
-contain arguments).  Whitespace is not allowed before the parens,
-but there is a corresponding C.() operator, which allows you to
-insert optional whitespace before the dot.
+Unlike in Perl 5, the notation Cfoo merely returns the Cfoo
+function as a Code object without calling it.  You may call any Code
+object parens (which may, of course, contain arguments).  Whitespace
+is not allowed before the parens, but there is a corresponding C.()
+operator, which allows you to insert optional whitespace before the dot.
 
 =item *
 
@@ -457,7 +456,7 @@
 
 foo:(Int,Num)
 
-It still just returns a function reference.  A call may also be partially
+It still just returns a CCode object.  A call may also be partially
 applied by using an argument list literal as a postfix operator:
 
 foo\(1,2,3,:miceblind)
@@ -496,12 +495,11 @@
 
 =item *
 
-A hash reference in numeric context returns the number of pairs
-contained in the hash.  A hash reference in a boolean context returns
-true if there are any pairs in the hash.  In either case, any intrinsic
-iterator would be reset.  (If hashes do carry an intrinsic iterator
-(as they do in Perl 5), there will be a C.reset method on the hash
-object to reset the iterator explicitly.)
+In numeric context, a Hash object returns the number of pairs contained
+in the hash.  Hash in a boolean context returns true if there are any pairs
+in the hash.  In either case, any intrinsic iterator would be reset.  (If
+hashes do carry an intrinsic iterator (as they do in Perl 5), there will
+be a C.reset method on the hash object to reset the iterator explicitly.)
 
 =item *
 
@@ -647,7 +645,7 @@
 
 =item *
 
-The current lexical symbol table may now be referenced through the
+The current lexical symbol table is now accessible through the
 pseudo-package CMY.  The current package symbol table is visible as
 pseudo-package COUR.  The COUTER name refers to the CMY symbol table
 immediately surrounding the current CMY, and COUTER::OUTER is the one
@@ -1400,12 +1398,12 @@
 numeric num Num +
 string  str Str ~
 
-There are also various reference contexts that require particular kinds of
-container references.
+There are also various container contexts that require particular kinds of
+containers.
 
 =item *
 
-Unlike

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

2006-04-05 Thread autrijus
Author: autrijus
Date: Wed Apr  5 19:18:40 2006
New Revision: 8570

Modified:
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S06.pod
   doc/trunk/design/syn/S09.pod
   doc/trunk/design/syn/S10.pod
   doc/trunk/design/syn/S12.pod

Log:
* S04/S06/S09/S10/S12: Excise reference from them.

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podWed Apr  5 19:18:40 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 19 Aug 2004
-  Last Modified: 1 Apr 2006
+  Last Modified: 6 Apr 2006
   Number: 4
-  Version: 12
+  Version: 13
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -400,8 +400,8 @@
 A Creturn always exits from the lexically surrounding sub
 or method definition (that is, from a function officially declared
 with the Csub, Cmethod, or Csubmethod keywords).  Pointy subs
-and bare closures are transparent to Creturn.  If you pass a reference
-to a closure outside of its official sub scope, it is illegal to
+and bare closures are transparent to Creturn.  If you pass a closure
+object outside of its official sub scope, it is illegal to
 return from it.  You may only leave the closure block itself with Cleave
 or by falling off the end of it.
 
@@ -828,9 +828,9 @@
 so that if you ever use the current reference to the routine, it gets
 the current snapshot of its world, lexically speaking.
 
-Some closures produce references at compile time that cannot be
+Some closures produce CCode objects at compile time that cannot be
 cloned, because they're not attached to any runtime code that can
-actively clone them.  CBEGIN, CCHECK, CINIT, and CEND blocks probably
+actively clone them.  CBEGIN, CCHECK, CINIT, and CEND blocks
 fall into this category.  Therefore you can't reliably refer to
 run-time variables from them even if they appear to be in scope.
 (The compile-time closure may, in fact, see a some kind of permanent

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podWed Apr  5 19:18:40 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 21 Mar 2003
-  Last Modified: 1 Apr 2006
+  Last Modified: 6 Apr 2006
   Number: 6
-  Version: 22
+  Version: 23
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -119,11 +119,11 @@
 
 Raw blocks are also executable code structures in Perl 6.
 
-Every block defines an object of type CCode, which may either be executed
-immediately or passed on as a CCode reference argument.  A
+Every block defines an object of type CCode, which may either be
+executed immediately or passed on as a CCode object.  A
 bare block where an operator is expected is bound to the current
 statement level control syntax.  A bare block where a term is expected
-merely produces a reference.  If the term bare block occurs in a list,
+merely produces a CCode object.  If the term bare block occurs in a list,
 it is considered the final element of that list unless followed immediately
 by a comma or comma surrogate.
 
@@ -399,7 +399,7 @@
 doit %hash{'b'}:p,1,2,3;
 
 instead..  (The C:p stands for pairs, not positional--the
-C:p adverb may be placed on any hash reference to make it mean
+C:p adverb may be placed on any Hash objects to make it mean
 pairs instead of values.)
 
 Pair constructors are recognized syntactically at the call level and
@@ -1821,7 +1821,7 @@
 } # Old values of $*foo and bar reinstated at this point
 
 Ctemp invokes its argument's C.TEMP method. The method is expected
-to return a reference to a subroutine that can later restore the current
+to return a CCode object that can later restore the current
 value of the object. At the end of the lexical scope in which the
 Ctemp was applied, the subroutine returned by the C.TEMP method is
 executed.
@@ -1979,7 +1979,7 @@
 
 textfrom := substr.assuming:str($text):len(Inf);
 
-It returns a reference to a subroutine that implements the same behaviour
+It returns a CCode object that implements the same behaviour
 as the original subroutine, but has the values passed to C.assuming
 already bound to the corresponding parameters:
 
@@ -2150,7 +2150,7 @@
 
 C{...} is always a block.  However, if it is completely empty or
 consists of a single list, the first element of which is either a hash
-or a pair, it is executed immediately to compose a hash reference.  
+or a pair, it is executed immediately to compose a Hash object.  
 
 The standard Cpair list operator is equivalent to:
 

Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podWed

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

2006-04-05 Thread autrijus
Author: autrijus
Date: Wed Apr  5 21:20:13 2006
New Revision: 8571

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

Log:
* Damian noted that the S02 chunk about Code object doesn't
  quite make sense anymore; fixed the grammar and supplied
  two examples.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr  5 21:20:13 2006
@@ -444,9 +444,14 @@
 
 Unlike in Perl 5, the notation Cfoo merely returns the Cfoo
 function as a Code object without calling it.  You may call any Code
-object parens (which may, of course, contain arguments).  Whitespace
-is not allowed before the parens, but there is a corresponding C.()
-operator, which allows you to insert optional whitespace before the dot.
+object with parens after it (which may, of course, contain arguments):
+
+foo($arg1, $arg2);
+
+Whitespace is not allowed before the parens, but there is a corresponding
+C.() operator, which allows you to insert optional whitespace before the dot:
+
+foo.($arg1, $arg2);
 
 =item *
 


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

2006-04-05 Thread autrijus
Author: autrijus
Date: Wed Apr  5 22:15:15 2006
New Revision: 8572

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

Log:
* S02: Grammar fixes from Uri.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr  5 22:15:15 2006
@@ -327,7 +327,7 @@
 Sigils are now invariant.  C$ always means a scalar variable, C@
 an array variable, and C% a hash variable, even when subscripting.
 Variables such as C@array and C%hash in scalar context simply
-returns themselves Array and Hash objects.
+return themselves as CArray and CHash objects.
 
 =item *
 
@@ -442,7 +442,7 @@
 
 =item *
 
-Unlike in Perl 5, the notation Cfoo merely returns the Cfoo
+Unlike in Perl 5, the notation Cfoo merely stands for the Cfoo
 function as a Code object without calling it.  You may call any Code
 object with parens after it (which may, of course, contain arguments):
 
@@ -500,11 +500,12 @@
 
 =item *
 
-In numeric context, a Hash object returns the number of pairs contained
-in the hash.  Hash in a boolean context returns true if there are any pairs
-in the hash.  In either case, any intrinsic iterator would be reset.  (If
-hashes do carry an intrinsic iterator (as they do in Perl 5), there will
-be a C.reset method on the hash object to reset the iterator explicitly.)
+In numeric context (i.e. when casted into CInt or CNum), a Hash object
+becomes the number of pairs contained in the hash.  In a boolean context, a
+Hash object is true if there are any pairs in the hash.  In either case,
+any intrinsic iterator would be reset.  (If hashes do carry an intrinsic
+iterator (as they do in Perl 5), there will be a C.reset method on the h
+hash object to reset the iterator explicitly.)
 
 =item *
 


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

2006-04-05 Thread autrijus
Author: autrijus
Date: Wed Apr  5 22:30:44 2006
New Revision: 8573

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

Log:
* S02: fix the three places where the old form:
$x  .(...)
  needs to be replaced to the new form:
$x.  (...)

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr  5 22:30:44 2006
@@ -358,7 +358,7 @@
 whatever was to their left.  Whitespace is not allowed between a
 variable name and its subscript.  However, there is a corresponding
 Bdot form of each subscript (C@foo.[1] and C%bar.{'a'}) which
-allows optional whitespace before the dot (except when interpolating).
+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 %bara  or C %bar.a .
 
@@ -449,9 +449,9 @@
 foo($arg1, $arg2);
 
 Whitespace is not allowed before the parens, but there is a corresponding
-C.() operator, which allows you to insert optional whitespace before the dot:
+C.() operator, which allows you to insert optional whitespace after the dot:
 
-foo.($arg1, $arg2);
+foo.   ($arg1, $arg2);
 
 =item *
 
@@ -1316,15 +1316,15 @@
 pairs.  To align values of option pairs, you may not use the
 dot postfix forms:
 
-:longkey  .($value)
-:shortkey .string
-:fookey   .{ $^a = $^b }
+:longkey.  ($value)
+:shortkey. string
+:fookey.   { $^a = $^b }
 
 These will be interpreted as
 
-:longkey(1)  .($value)
-:shortkey(1) .string
-:fookey(1)   .{ $^a = $^b }
+:longkey(1).  ($value)
+:shortkey(1). string
+:fookey(1).   { $^a = $^b }
 
 You just have to put spaces inside the parenthesis form to align things.
 


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

2006-04-05 Thread autrijus
Author: autrijus
Date: Wed Apr  5 22:38:07 2006
New Revision: 8574

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

Log:
* S02: use sane (and valid) examples for rule_mod_internal and
   rule_mod_external grammatical categories.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podWed Apr  5 22:38:07 2006
@@ -1614,8 +1614,8 @@
 rule_metachar:,   /,/
 rule_backslash:w  /\w/ and /\W/
 rule_assertion:*  /*stuff/
-rule_mod_internal:p5  m:p5//
-rule_mod_external:p5  m:p5//
+rule_mod_internal:perl5   m:/ ... :perl5 ... /
+rule_mod_external:nth m:nth(3)/ ... /
 trait_verb:handleshas $.tail handles wag
 trait_auxiliary:shall my $x shall conformTR123
 scope_declarator:has  has $.x;


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

2006-04-03 Thread autrijus
Author: autrijus
Date: Mon Apr  3 05:47:07 2006
New Revision: 8553

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

Log:
* S09: Leo pointed out the paragraph on autovivifiction 
  is still mentioning references.  Replace it with modern
  wording (surface semantics stays unchanged)

Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podMon Apr  3 05:47:07 2006
@@ -696,9 +696,10 @@
 my $val := $hash{foo}{bar};
 
 my @array;
-my $ref = \$array[0][0];
+my $ref = \$array[0][0]; # $ref is an Arguments object - see S02
 
 my %hash;
 $hash{foo}{bar} = foo; # duh
 
-This rule applies to dereferencing arrays, hashes, and scalar references.
+This rule applies to CArray, CHash, and CScalar container objects.
+


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

2006-04-03 Thread autrijus
Author: autrijus
Date: Mon Apr  3 15:48:30 2006
New Revision: 8555

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

Log:
* S06: Make it clear that concat-means-concat for duplicated
   named arguments, and that it is possible to bind a tuple 
   into a scalar.

sub fun (Int @x) { ... }
fun( x = (1, 2), x = (3, 4) );# @x := (1, 2, 3, 4)

sub fun (Int $x) { ... }
fun( x = (1, 2), x = (3, 4) );# $x := (3, 4)


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podMon Apr  3 15:48:30 2006
@@ -423,15 +423,17 @@
 to be concatenated:
 
 sub fun (Int @x) { ... }
-fun( x = 1, x = 2 );  # @x := (1, 2)
+fun( x = 1, x = 2 );  # @x := (1, 2)
+fun( x = (1, 2), x = (3, 4) );# @x := (1, 2, 3, 4)
 
 Other sigils binds only to the Ilast argument with that name:
 
 sub fun (Int $x) { ... }
-f( x = 1, x = 2 );# $x := 2
+f( x = 1, x = 2 );# $x := 2
+fun( x = (1, 2), x = (3, 4) );# $x := (3, 4)
 
-This means a defaults must come Ibefore known named parameters,
-similar to how hash constructors work:
+This means a hash holding default values must come Ibefore known named
+parameters, similar to how hash constructors work:
 
 # Allow x and y in %defaults be overrided
 f( *%defaults, x = 1, y = 2 );


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 10:32:53 2006
New Revision: 8520

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

Log:
* S02: destill the compoments of an Arguments object, and
   specify the $() @() %() () casting forms for them.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Apr  1 10:32:53 2006
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 1 Apr 2006
   Number: 2
-  Version: 18
+  Version: 19
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -393,6 +393,17 @@
 bound to.  Some bindings are sensitive to multiple dimensions while
 others are not.
 
+You may cast CArguments to other types with a prefix sigil operator:
+
+$args = \3; # same as $args = \(3)
+$$args; # same as $args as Scalar or Scalar($args)
+@$args; # same as '$args as Array  or Array($args)
+%$args; # same as '$args as Hash   or Hash($args)
+$args; # same as '$args as Code   or Hash($args)
+
+Casted as an array, you can access to all positionals.  Casted as a hash, all
+nameds.  As a scalar, the invocant.  As a code, the slurpy nameless block.
+
 =item *
 
 A signature object (CSignature) may be created with coloned parens:
@@ -430,7 +441,7 @@
 foo:(Int,Num)
 
 It still just returns a function reference.  A call may also be partially
-applied by using a tuple literal as a postfix operator:
+applied by using an argument list literal as a postfix operator:
 
 foo\(1,2,3,:miceblind)
 


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 10:35:35 2006
New Revision: 8522

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

Log:
* S04: Specify fail semantics in detail, and the relationship
   to the environmental $! variable.  Handling and propagation
   of unthrown exceptions clarified.

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podSat Apr  1 10:35:35 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 19 Aug 2004
-  Last Modified: 28 Mar 2006
+  Last Modified: 1 Apr 2006
   Number: 4
-  Version: 11
+  Version: 12
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -464,38 +464,34 @@
 =head1 Exceptions
 
 As in Perl 5, many built-in functions simply return undef when you ask
-for a value out of range, or the function fails somehow.  Unlike in
-Perl 5, these may be interesting values of undef that contain
-information about the error.  If you try to use an undefined value,
-that information can then be conveyed to the user.  In essence, undef
-can be an unthrown exception object that just happens to return 0 when
-you ask it whether it's defined or it's true.  Since C$! contains the
-current error code, saying Cdie $! will turn an unthrown exception
-into a thrown exception.  (A bare Cdie does the same.)
+for a value out of range, or the function fails somehow.  Perl 6 has
+CFailure objects, which refers to an unthrown CException object in
+C$! and knows whether it has been handled or not.
+
+If you test a CFailure for C.id, C.defined or C.true, it causes
+C$! to mark the exception as Ihandled, and acts as a harmless CUndef
+value thereafter.  Any other use of the CFailure will throw its associated
+exception immediately.
+
+Because the Cenv variable C$! contains all exceptions collected in the
+current lexical scope, saying Cdie $! will throw all exceptions,
+whether they were handled or not.  A bare Cdie/Cfail takes C$! as the
+default argument.
+
+At scope exit, C$! discards all handled exceptions from itself, then performs
+a GC check for all remaining (unhandled) exceptions.  If all of them are still
+alive (e.g. by becoming part of the return value), then they are appended to
+C CALLER::$! .  Otherwise, it calls Cdie to throw those exceptions
+as a single new exception, which may then be caught with a CCATCH block in
+the current (or caller's) scope.
 
 You can cause built-ins to automatically throw exceptions on failure using
 
 use fatal;
 
-The Cfail function responds to the caller's use fatal state.  It
+The Cfail function responds to the caller's Cuse fatal state.  It
 either returns an unthrown exception, or throws the exception.
 
-If an exception is raised while C$! already contains an exception
-that is active and unhandled, no information is discarded.  The old
-exception is pushed onto the exception stack within the new exception,
-which is then bound to C$! and, hopefully, propagated.  The default
-printout for the new exception should include the old exception
-information so that the user can trace back to the original error.
-(Likewise, rethrown exceptions add information about how the exception
-is propagated.)  The exception stack within C$! is available as
-C$![].
-
-Exception objects are born unhandled.  The C$! object keeps track of
-whether it's currently handled or unhandled.  The exception in C$! still
-exists after it has been caught, but catching it marks it as handled
-if any of the cases in the switch matched.  Handled exceptions don't
-require their information to be preserved if another exception occurs.
-
 =head1 Closure traits
 
 A CCATCH block is just a trait of the closure containing it.  Other


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 10:36:25 2006
New Revision: 8523

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

Log:
* S05: $/.() is now $$/.  $() still works as $$/, and we
  have @() %() forms that maps to @$/ and %$/.

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podSat Apr  1 10:36:25 2006
@@ -13,9 +13,9 @@
 
Maintainer: Patrick Michaud [EMAIL PROTECTED]
Date: 24 Jun 2002
-   Last Modified: 25 Feb 2006
+   Last Modified: 1 Apr 2006
Number: 5
-   Version: 12
+   Version: 13
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them rules because they haven't been
@@ -1120,18 +1120,18 @@
 
 =item *
 
-When called as a closure, a Match object evaluates to its underlying
+When used as a scalar, a Match object evaluates to its underlying
 result object.  Usually this is just the entire match string, but
 you can override that by calling Creturn inside a rule:
 
-my $moose = m:{
+my $moose = $(m:{
 antler body
 { return Moose.new( body = $body().attach($antler) ) }
 # match succeeds -- ignore the rest of the rule
-}.();
+});
 
-C$() is a shorthand for C$/.() or C$/().  The result object
-may be of any type, not just a string.
+C$() is a shorthand for C$($/).  The result object may be of any type,
+not just a string.
 
 You may also capture a subset of the match as the result object using
 the C (...)  construct:
@@ -1149,8 +1149,8 @@
 
 This means that these two work the same:
 
-/ moose { $moose.() as Moose } /
-/ moose { $mooseas Moose } /
+/ moose { return $$moose as Moose } /
+/ moose { return $moose  as Moose } /
 
 =item *
 
@@ -1172,8 +1172,13 @@
 
  $mystring = { m:w/ (\S+) = (\S+)/[] };
 
+Or cast it into an array:
+
+ $mystring = @( m:w/ (\S+) = (\S+)/ );
+
 Note that, as a scalar variable, C$/ doesn't automatically flatten
-in list context.  Use C@$/ or C$/[] to flatten as an array.
+in list context.  Use C@() as a shorthand for C@($/) to flatten
+the positional captures under list context.
 
 =item *
 
@@ -1185,8 +1190,8 @@
 capture datatypes.)
 
 Note that, as a scalar variable, C$/ doesn't automatically flatten
-in list context.  Use C%$/ or C$/{} to flatten as a hash, or bind
-it to a variable of the appropriate type.
+in list context.  Use C%() as a shorthand for C%($/) to flatten as a
+hash, or bind it to a variable of the appropriate type.
 
 =item *
 


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 10:43:08 2006
New Revision: 8524

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

Log:
* S06: De-mystifying the logic for named arguments.

   *$x is now just casting $x as an Arguments object.

   Differ between foo; and foo(); via zero-dimensional slices.

   Split the semantic of Undef and Failure types.

   Add a more comprehensive list of builtin classes.

   Allow named returns via the return function.

   Routine's .wrap semantic is now much clarified.

   ?SUB is renamed to ?ROUTINE; remove the $?BLOCKLABEL
   and $?SUBNAME magicals (they are now just methods);
   clarify the ?BLOCK means the immediate block, even
   if it's part of a routine.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Apr  1 10:43:08 2006
@@ -15,7 +15,7 @@
   Date: 21 Mar 2003
   Last Modified: 1 Apr 2006
   Number: 6
-  Version: 20
+  Version: 21
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -370,7 +370,6 @@
 subscript instead of the sigil.  The C: is not functioning as an
 operator here, but as a modifier of the following token:
 
-
 doit %hash:a,1,2,3;
 doit %hash:{'b'},1,2,3;
 
@@ -390,15 +389,15 @@
 C:p adverb may be placed on any hash reference to make it mean
 pairs instead of values.)
 
-Pairs are recognized syntactically at the call level and mystically
-transformed into special CNamed objects that may be bound to
-positionals only by name, not as ordinary positional CPair objects.
-Leftover special CNamed objects can be slurped into a slurpy hash.
+Pair constructors are recognized syntactically at the call level and
+put into the named slot of the CArguments structure.  Hence they may be
+bound to positionals only by name, not as ordinary positional CPair
+objects.  Leftover named arguments can be slurped into a slurpy hash.
 
 After the positional and named arguments, all the rest of the arguments
 are taken to be list arguments.  Any pairs within the list are taken
-to be list elements rather than named arguments, and mystically show
-up as CPair arguments even if the compiler marked them as CNamed.
+to be list elements rather than named arguments, and show up as CPair
+arguments even if the compiler marked them as named.
 
 It is possible that named pairs are not really a separate type; it
 would be sufficient to have a bit somewhere in the Pair that can be
@@ -498,7 +497,7 @@
 $comparison = numcmp(:y(7), :x(2));
 
 Passing the wrong number of required arguments to a normal subroutine
-is a fatal error.  Passing a NamedArg that cannot be bound to a normal
+is a fatal error.  Passing a named argument that cannot be bound to a normal
 subroutine is also a fatal error.  (Methods are different.)
 
 The number of required parameters a subroutine has can be determined by
@@ -664,11 +663,14 @@
 
 =head2 Argument list binding
 
-The underlying argument list (List) object may be bound to a single
-scalar parameter marked with a C\:
+The underlying CArguments object may be bound to a single scalar
+parameter marked with a C\.
 
-sub foo (\$args) { say $args.perl; bar.call(*$args); }
 sub bar ($a,$b,$c,:$mice) { say $mice }
+sub foo (\$args) { say $args.perl; bar.call($args); }
+
+The C.call method of CCode objects accepts a single CArguments
+object, and calls it without introducing a CCALLER frame.
 
 foo 1,2,3,:miceblind;# says \(1,2,3,:miceblind) then blind
 
@@ -685,16 +687,27 @@
 
 =head2 Flattening argument lists
 
-The unary prefix operator C* dereferences its operand (which allows
-the elements of an array or iterator or List or Tuple to be used as
-part of an argument list). The C* operator also causes its operand --
-and any subsequent arguments in the argument list -- to be evaluated in
-list context.  It also turns off syntactic recognition of named pairs.
-The eventual argument list will be parsed at call time for named pairs.
-All contiguous pairs are treated as named arguments until the first
-non-Pair, and the rest of the arguments are considered slurpy args.
-[XXX still underspecified...]
+The unary prefix operator C* casts a value to an CArguments
+object, then splices it into the argument list it occurs in.
+
+Casting CArguments to CArguments is a no-op:
+
+*(\(1, x=2));# Arguments, becomes \(1, x=2)
+
+CPair and CHash become named arguments:
+
+*(x=1);  # Pair, becomes \(x=1)
+*{x=1, y=2};# Hash, becomes \(x=1, y=2)
+
+CList (also CTuple, CRange, etc.) are simply turned into
+positional arguments:
 
+*(1,2,3); # Tuple, 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))
+
+For example:
 
 sub foo($x, $y, $z) {...}# expects three

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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 10:43:58 2006
New Revision: 8525

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

Log:
* S11: Allow user-defined dynamic exportation with EXPORT
   routines, which assume the semantic from Damian's
   Perl6::Export::Attrs.
   
   The magical export dispatcher is now EXPORTALL.

Modified: doc/trunk/design/syn/S11.pod
==
--- doc/trunk/design/syn/S11.pod(original)
+++ doc/trunk/design/syn/S11.podSat Apr  1 10:43:58 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 27 Oct 2004
-  Last Modified: 17 Mar 2006
+  Last Modified: 1 Apr 2006
   Number: 11
-  Version: 10
+  Version: 11
 
 =head1 Overview
 
@@ -105,7 +105,18 @@
 }
 
 The CFoo module will export Cfoo, Cbar and Cbaz by default;
-calling CFoo::Bar.import will import Cbar and Cbaz at runtime.
+calling CFoo::Bar.EXPORTALL will export Cbar and Cbaz at runtime
+to the caller's package.
+
+=head1 Dynamic exportation
+
+The default CEXPORTALL handles symbol exports by removing recognized
+export items and tagsets from the argument list, then calls the CEXPORT
+subroutine in that module (if there is one), passing in the remaining
+arguments.
+
+If the exporting module is actually a class, CEXPORTALL will invoke its
+CEXPORT method with the class itself as the invocant.
 
 =head1 Compile-time Importation
 
@@ -155,7 +166,7 @@
 at runtime cannot import into the lexical scope:
 
 require Sense;
-Sense.import;   # goes to the OUR scope by default, not MY
+Sense.EXPORTALL;   # goes to the OUR scope by default, not MY
 
 =head1 Importing from a pseudo-package
 


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 10:44:53 2006
New Revision: 8526

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

Log:
* S12: The call form can now be used to call the next
   MMD or SMD candidate.

   A proto declaration needs to happen before multis.

   Fix a misuse of .call method.

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podSat Apr  1 10:44:53 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 27 Oct 2004
-  Last Modified: 23 Feb 2006
+  Last Modified: 1 Apr 2006
   Number: 12
-  Version: 10
+  Version: 11
 
 =head1 Overview
 
@@ -542,6 +542,13 @@
 :omit(Selector) # only classes that don't match selector
 :include(Selector)  # only classes that match selector
 
+In addition to Cnext METHOD, the special function Ccall dispatches
+to the next candidate, possibly with a new argument list:
+
+call;   # calls with the original arguments
+call(); # calls with no arguments
+call(1,2,3);# calls with a different set of arguments
+
 =head1 Parallel dispatch
 
 Any of the method call forms may be turned into a hyperoperator by
@@ -681,6 +688,8 @@
 
 The Csub keyword is optional after either Cmulti or Cproto.
 
+A Cproto declaration must come before any matching multis, if at all.
+
 =head1 Roles
 
 Classes are primarily in charge of object management, and only
@@ -704,7 +713,7 @@
method feed ($food) {
$food.open_can;
$food.put_in_bowl;
-   self.call;
+   self.some_other_method;
}
 }
 


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 14:01:16 2006
New Revision: 8528

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

Log:
* S06+S12: Split the old multiple-dispatch into two distinct ideas:

- Method call vs Subroutine call
- Multiple dispatch vs Single dispatch

  A multi-method or multi-sub is simply a method/sub that has variants,
  and has nothing to do with transcending class boundaries.

  TimToady With a multi-sub, it's the sub-ness that transcends class
 boundaries, not the multi-ness.

  Consequently, $x.foo(3) still falls back to foo($x, 3) if there is
  not such method, but foo($x, 3) won't magically call the foo method
  even if it's declared as a multi-method.  To get the old magical dual
  behaviour, use multi submethod.

  multi foo within a class/role now means multi method foo.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Apr  1 14:01:16 2006
@@ -34,13 +34,6 @@
 subroutines masquerading as methods. They have an invocant and belong to
 a particular kind or class.
 
-BMultimethods (keyword: Cmulti) are routines that transcend class
-boundaries, and can have one or more invocants. 
-
-BPrototypes (keyword: Cproto) specify the commonalities (such
-as parameter names, fixity and associativity) shared by all multis
-of that name in the scope of the Cproto declaration.
-
 BRules (keyword: Crule) are methods (of a grammar) that perform
 pattern matching. Their associated block has a special syntax (see
 Synopsis 5).
@@ -52,6 +45,32 @@
 as they are parsed (i.e. at compile-time). Macros may return another
 source code string or a parse-tree.
 
+=head1 Routine modifiers
+
+BMultimethods (keyword: Cmulti) are routines that can have multiple
+variants that shares the same name, selected by arity, types, or some
+other constraints.  They may have multliple invocants.
+
+BPrototypes (keyword: Cproto) specify the commonalities (such
+as parameter names, fixity and associativity) shared by all multis
+of that name in the scope of the Cproto declaration.
+
+A modifier keyword may occur before the routine keyword in a named routine:
+
+proto sub foo {...}
+multi sub foo {...}
+proto method bar {...}
+multi method bar {...}
+
+If the routine keyword is omitted, it defaults to Cmethod inside a
+class or role, and Csub inside a module or package.
+
+class C {
+multi foo {...} # multi method foo
+}
+module M {
+multi bar {...} # multi sub bar
+}
 
 =head2 Named subroutines
 
@@ -427,7 +446,7 @@
 
 =head2 Invocant parameters
 
-A method invocant is specified as the first parameter in the parameter
+A method invocant may be specified as the first parameter in the parameter
 list, with a colon (rather than a comma) immediately after it:
 
 method get_name ($self:) {...}
@@ -442,31 +461,36 @@
 Multimethod and multisub invocants are specified at the start of the parameter
 list, with a colon terminating the list of invocants:
 
-multi sub handle_event ($window, $event: $mode) {...}# two invocants
+multi sub handle_event ($window, $event: $mode) {...}   # two invocants
+multi method set_name ($self, $name: $nick) {...}   # two invocants
 
-Multi invocant arguments are passed positionally, though the first
-invocant can be passed via the method call syntax if the multi happens
-to be defined as a multi method within the class of the first invocant.
-
-# Multimethod calls...
-handle_event($w, $e, $m);
-$w.handle_event($e, $m);
+If the parameter list for a Cmulti contains no colon to delimit
+the list of invocant parameters, then all positional parameters are
+considered invocants.  If it's a Cmulti method and Cmulti submethod,
+an additional implicit unamed Cself invocant is prepended to the
+signature list.
+
+For the purpose of matching positional arguments against invocant parameters,
+the invocant argument passed via the method call syntax is considered the
+first positional argument:
+
+handle_event($w, $e, $m);   # calls the multi sub
+$w.handle_event($e, $m);# ditto, but only if there is no
+# suitable $w.handle_event method
 
 Invocants may also be passed using the indirect object syntax, with a colon
 after them. The colon is just a special form of the comma, and has the
 same precedence:
 
-# Indirect method call...
-set_name $obj: Sam;
-
-# Indirect multimethod call...
-handle_event $w, $e: $m;
+set_name $obj: Sam;   # try $obj.set_name(Sam) first, then
+# fall-back to set_name($obj, Sam)
+$obj.set_name(Sam);   # same as the above
 
 Passing too many or too few invocants is a fatal error if no matching
 definition can be found.
 
 An invocant is the topic of the corresponding method

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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 14:07:20 2006
New Revision: 8529

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

Log:
* Bump version for the affected S06, S12 and S13.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Apr  1 14:07:20 2006
@@ -15,7 +15,7 @@
   Date: 21 Mar 2003
   Last Modified: 1 Apr 2006
   Number: 6
-  Version: 21
+  Version: 22
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podSat Apr  1 14:07:20 2006
@@ -14,7 +14,7 @@
   Date: 27 Oct 2004
   Last Modified: 1 Apr 2006
   Number: 12
-  Version: 11
+  Version: 12
 
 =head1 Overview
 

Modified: doc/trunk/design/syn/S13.pod
==
--- doc/trunk/design/syn/S13.pod(original)
+++ doc/trunk/design/syn/S13.podSat Apr  1 14:07:20 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 2 Nov 2004
-  Last Modified: 21 Aug 2005
+  Last Modified: 1 Apr 2006
   Number: 13
-  Version: 3
+  Version: 4
 
 =head1 Overview
 


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 19:35:01 2006
New Revision: 8531

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

Log:
* S02: typo fix and wording cleanup from Uri Guttman.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Apr  1 19:35:01 2006
@@ -401,8 +401,9 @@
 %$args; # same as '$args as Hash   or Hash($args)
 $args; # same as '$args as Code   or Code($args)
 
-Casted as an array, you can access to all positionals.  Casted as a hash, all
-nameds.  As a scalar, the invocant.  As a code, the slurpy nameless block.
+When cast into an array, you can access all the positional arguments; Into a
+hash, all named arguments; Into a scalar, the invocant; Into code, its slurpy
+nameless block.
 
 All prefix sigil operators accept one positional argument, evaluated in
 scalar context as a rvalue.  They can interpolate in strings if called with


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 20:10:15 2006
New Revision: 8532

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

Log:
* upper/lowercase English nit fix for the last patch as suggested by TimToady 

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSat Apr  1 20:10:15 2006
@@ -401,8 +401,8 @@
 %$args; # same as '$args as Hash   or Hash($args)
 $args; # same as '$args as Code   or Code($args)
 
-When cast into an array, you can access all the positional arguments; Into a
-hash, all named arguments; Into a scalar, the invocant; Into code, its slurpy
+When cast into an array, you can access all the positional arguments; into a
+hash, all named arguments; into a scalar, the invocant; into code, its slurpy
 nameless block.
 
 All prefix sigil operators accept one positional argument, evaluated in


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 20:46:57 2006
New Revision: 8533

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

Log:
* S13: specify type casting in the form of
multi submethod *infix:as
  which usually only cares about the class of its second invocant.

Modified: doc/trunk/design/syn/S13.pod
==
--- doc/trunk/design/syn/S13.pod(original)
+++ doc/trunk/design/syn/S13.podSat Apr  1 20:46:57 2006
@@ -116,3 +116,17 @@
 this hash over a lexical scope, so you could have different policies
 on magical autogeneration.  The default mappings correspond to the
 standard fallback mappings of Perl 5 overloading.
+
+=head1 Type Casting
+
+A class can use the C *infix:as  submethod to declare that its objects
+can be casted to some other class:
+
+multi submethod *infix:as (IO)  { $*OUT }
+multi submethod *infix:as (Int) { 1 }
+multi submethod *infix:as (Str) { Hello }
+
+With the above declaration, C$obj as foo is equivalent to C$obj as Str,
+because the multi dispatch cares only about the class.
+
+=cut


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 20:49:18 2006
New Revision: 8534

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

Log:
* Larry (aka TimToady in the previous commit log; sorry for
  spilling of IRC context) requested that multi should still
  only default to multi sub to reduce lookarounds. 
* Clarify that unary operators such as !$x always prefers
  method dispatch first, as $x.prefix!.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Apr  1 20:49:18 2006
@@ -62,15 +62,7 @@
 proto method bar {...}
 multi method bar {...}
 
-If the routine keyword is omitted, it defaults to Cmethod inside a
-class or role, and Csub inside a module or package.
-
-class C {
-multi foo {...} # multi method foo
-}
-module M {
-multi bar {...} # multi sub bar
-}
+If the routine keyword is omitted, it defaults to Csub.
 
 =head2 Named subroutines
 
@@ -467,7 +459,7 @@
 If the parameter list for a Cmulti contains no colon to delimit
 the list of invocant parameters, then all positional parameters are
 considered invocants.  If it's a Cmulti method and Cmulti submethod,
-an additional implicit unamed Cself invocant is prepended to the
+an additional implicit unnamed Cself invocant is prepended to the
 signature list.
 
 For the purpose of matching positional arguments against invocant parameters,

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podSat Apr  1 20:49:18 2006
@@ -651,6 +651,10 @@
 
 close($handle,)
 
+This applies to prefix unary operators as well:
+
+!$obj;  # same as $obj.prefix:!
+
 A method call first considers methods (including multi-methods and submethods)
 from the class hierarchy of C$handle, and fails over to the subroutine
 dispatcher as a last resort only if no method can be found in the class
@@ -686,9 +690,7 @@
 
 The syntax for calling back to CMyClass is C$obj!MyClass::meth().
 
-Outside a class or a role, the Csub keyword is optional after either
-Cmulti or Cproto.  Within a class or a role, the Cmethod keyword
-is implied instead of Csub.
+The Csub keyword is optional after either Cmulti or Cproto.
 
 A Cproto declaration must come before any matching multis, if at all.
 


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

2006-04-01 Thread autrijus
Author: autrijus
Date: Sat Apr  1 21:18:08 2006
New Revision: 8535

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

Log:
* S06: Rationalize the free mix of named and positional args.

   Positional pair arguments must _always_ be put in parentheses.

   Multiple named arguments with the same name can be concatenated
   into a @param now.  $param gets the _last_ named argument,
   similar to how hash constructor and rule bindings work.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSat Apr  1 21:18:08 2006
@@ -338,6 +338,8 @@
 possible on those arguments that are bound to a final slurpy or
 arglist variable.)
 
+=head2 Named arguments
+
 Named arguments are recognized syntactically at the
 comma level.  Pairs intended as positional arguments rather than
 named arguments must be isolated by extra parens:
@@ -405,36 +407,34 @@
 bound to positionals only by name, not as ordinary positional CPair
 objects.  Leftover named arguments can be slurped into a slurpy hash.
 
-After the positional and named arguments, all the rest of the arguments
-are taken to be list arguments.  Any pairs within the list are taken
-to be list elements rather than named arguments, and show up as CPair
-arguments even if the compiler marked them as named.
-
-It is possible that named pairs are not really a separate type; it
-would be sufficient to have a bit somewhere in the Pair that can be
-interrogated under the C.named property.  The compiler is allowed to
-stop marking named pairs at the first C == , but the code that
-converts unused positional arguments to implicit slurpy list needs to
-be careful to clear the C.named property on arguments so converted.
-For instance, if you say
+Because named and positional arguments can be freely mixed, the
+programmer always needs to disambiguate pairs literals from named
+arguments with parenthesis:
 
+# Named argument a
 push @array, 1, 2, :ab;
 
-the compiler cannot know that the slurpy list starts at 1, so it markes
-:ab as a named pair.  But that mark needs to be cleared, or
+# Pair object (a='b')
+push @array, 1, 2, (:ab);
+
+Perl 6 allows multiple same-named arguments, and records the relative
+order of arguments with the same name.  When there are more than one
+argument, the C@ sigil in the parameter list causes the arguments
+to be concatenated:
 
-say pop(@array);
+sub fun (Int @x) { ... }
+fun( x = 1, x = 2 );  # @x := (1, 2)
 
-will then think you said:
+Other sigils binds only to the Ilast argument with that name:
 
-say *pop(@array);
+sub fun (Int $x) { ... }
+f( x = 1, x = 2 );# $x := 2
 
-and treat :ab as a named argument to print, which is not what you want.
+This means a defaults must come Ibefore known named parameters,
+similar to how hash constructors work:
 
-In any event, the named parameters need to be kept in the list until
-bound.  An implementation that pulls named parameters out of the list
-into a hash prematurely will lose the ordering of the push above,
-for instance.
+# Allow x and y in %defaults be overrided
+f( *%defaults, x = 1, y = 2 );
 
 =head2 Invocant parameters
 


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

2006-03-31 Thread autrijus
Author: autrijus
Date: Fri Mar 31 03:16:08 2006
New Revision: 8502

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

Log:
* S02: Explicit division of immutable/mutable/native types.
* S02: Int's bigint autopromotion must not change its underlying
   type (i.e. int - BigInt), and must support Inf/NaN.
* S02: Unify terminology: value/natural/native etc is now just
   native for describing lower-case classes.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Mar 31 03:16:08 2006
@@ -177,22 +177,26 @@
 
 my int @array is MyArray;
 
-you are declaring that the elements of C@array are integers,
+you are declaring that the elements of C@array are native integers,
 but that the array itself is implemented by the CMyArray class.
 Untyped arrays and hashes are still perfectly acceptable, but have
 the same performance issues they have in Perl 5.
 
 =item *
 
-Built-in object types start with an uppercase letter: CInt, CNum,
-CComplex, CStr, CBit, CRef, CScalar, CArray, CHash,
-CRule and CCode.  Non-object (value) types are lowercase: Cint,
-Cnum, Ccomplex, Cstr, Cbit, and Cref.  Value 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 repeated autoboxing can slow your program more
-than the native type can speed it up.)
+Built-in object types start with an uppercase letter. This includes
+immutable types (e.g. CInt, CNum, CComplex, CRational, CStr,
+CBit, CRule, CSet, CJunction, CList, CTuple), as well as
+mutable (container) types, such as CScalar, CArray, CHash,
+CCode, CModule, etc.
+
+Non-object (native) types are lowercase: Cint, Cnum, Ccomplex,
+Crational, Cstr, Cbit.  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
+repeated autoboxing can slow your program more than the native type
+can speed it up.)
 
 =item *
 
@@ -213,14 +217,20 @@
 
 Perl 6 intrinsically supports big integers and rationals through its
 system of type declarations.  CInt automatically supports promotion
-to arbitrary precision.  (CNum may support arbitrary-precision
-floating-point arithmatic, but is not required to unless we can do
-so portably and efficiently.)  CRat supports arbitrary precision
-rational arithmetic.  Value types like Cint and Cnum imply
-the natural machine representation for integers and floating-point
-numbers, respectively, and do not promote to arbitrary precision.
-Untyped numeric scalars use CInt and CNum semantics rather than
-Cint and Cnum.
+to arbitrary precision, as well as holding CInf and CNaN values.
+
+(CNum may support arbitrary-precision floating-point arithmatic, but
+is not required to unless we can do so portably and efficiently.)
+
+CRational supports arbitrary precision rational arithmetic.  However,
+dividing two CInt objects produces fractionals as CNum objects by
+default, not CRational objects.  You can override this behavior with
+a pragma.
+
+Lower-case types like Cint and Cnum imply the native machine
+representation for integers and floating-point numbers, respectively, and
+do not promote to arbitrary precision.  Untyped numeric scalars use CInt
+and CNum semantics rather than Cint and Cnum.
 
 =item *
 
@@ -365,25 +375,27 @@
 
 =item *
 
-An argument list object (CList) may be created with backslashed parens:
+An argument list object (CArguments) may be created with backslashed parens:
 
 $args = \(1,2,3,:miceblind)
 
-A CList's values are parsed as ordinary expressions.  By default a
-CList is lazy.  This interacts oddly with the fact that a CList
-is immutable in the abstract.  Once all of a CList's arguments are
-fully evaluated (which happens at compile time when all the arguments
-are constants), the CList functions as an immutable tuple type.
-Before that moment, the eventual value may well be unknown.  All we
-know is that is that we have the promise to make the bits of it
-immutable as they become known.  CList objects may contain multiple
-unresolved iterators such as pipes or slices.  How these are resolved
-depends on what they are eventually bound to.  Some bindings are
-sensitive to multiple dimensions while others are not.
+Values in CArguments values are parsed as ordinary expressions, marked as
+positional, named, to-be-flattened, and so on.
+
+Like CList objects, CArguments are immutable in the abstract, but
+evaluates its arguments lazily.  Before everything inside a CArguments are
+fully evaluated (which happens at compile time when all the arguments are
+constants), the eventual value may well

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

2006-03-31 Thread autrijus
Author: autrijus
Date: Fri Mar 31 04:07:40 2006
New Revision: 8504

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

Log:
* S06: Updated built-in classes:
  - bring in uint from S09 (boxes to Int)
  - new Buf class to represent subscriptable byte streams
  - Arguments and Signature from S02
  - explicit Scalar container type from other places in S06

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri Mar 31 04:07:40 2006
@@ -1242,44 +1242,55 @@
 
 Note that placeholder variables syntactically cannot have type constraints.
 
-=head1 Types
+=head1 Built-in Types
 
 These are some of the standard type names in Perl 6 (at least this week):
 
+=head2 Native types
+
 bit single native bit
-int native integer
-buf native 8-bit string (sequence of 8-bit integers, no Unicode)
-str native string (sequence of arbitrary integers, no Unicode)
+int native signed integer
+uintnative unsigned integer (autoboxes to Int)
+buf native bytes (finite sequence of uint8s, no Unicode)
+str native string (finite sequence of native integers, no Unicode)
 num native floating point
 complexnative complex number
-ref native pointer 
 boolnative boolean
+
+=head2 Immutable types
+
 Bit Perl single bit (allows traits, aliasing, undef, etc.)
-Int Perl integer (allows traits, aliasing, undef, etc.)
-Str Perl string (Unicode semantics)
+Int Perl integer (allows Inf/NaN, arbitrary precision, etc.)
+Buf Perl buffer (possibly lazy list of bytes, can be subscripted)
+Str Perl string (finite sequence of Unicode characters)
 Num Perl number
 Complex Perl complex number
 BoolPerl boolean
+CodeBase class for all executable objects
+Block   Base class for all embedded executable objects
+ListLazy Perl list
+Tuple   Completely evaluated (hence immutable) list
+Signature   Function parameters (left-hand side of a binding)
+Arguments   Function call arguments (right-hand side of a binding)
+
+=head2 Mutable types
+
 Array   Perl array
 HashPerl hash
+Scalar  Perl scalar
 IO  Perl filehandle
-CodeBase class for all executable objects
 Routine Base class for all nameable executable objects
 Sub Perl subroutine
 Method  Perl method
 Submethod   Perl subroutine acting like a method
 Macro   Perl compile-time subroutine
 RulePerl pattern
-Block   Base class for all embedded executable objects
 Package Perl 5 compatible namespace
 Module  Perl 6 standard namespace
 Class   Perl 6 standard class namespace
 RolePerl 6 standard generic interface/implementation
 Object  Perl 6 object
 Grammar Perl 6 pattern matching namespace
-ListLazy Perl list
-Tuple   Completely evaluated (hence immutable) list
-
 
 =head2 Value types
 
@@ -1784,7 +1795,7 @@
 
 =head2 Wrapping
 
-Every subroutine has a C.wrap method. This method expects a single
+Every CRoutine object has a C.wrap method. This method expects a single
 argument consisting of a block, closure, or subroutine. That argument
 must contain a call to the special Ccall function:
 
@@ -1860,7 +1871,7 @@
 
 =head2 Currying
 
-Every subroutine has an C.assuming method. This method does a partial
+Every CCode object has an C.assuming method. This method does a partial
 binding of a set of arguments to a signature and returns a new function
 that takes only the remaining arguments.
 


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

2006-03-31 Thread autrijus
Author: autrijus
Date: Fri Mar 31 04:10:36 2006
New Revision: 8505

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

Log:
* excise the ref from S09

Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podFri Mar 31 04:10:36 2006
@@ -101,8 +101,8 @@
 my num @nums;
 my int4 @nybbles;
 my buf @buffers;
-my ref[Array] @ragged2d;
 my complex128 @longdoublecomplex;
+my Array @ragged2d;
 
 the presence of a low-level type tells Perl that it is free to
 implement the array with compact storage, that is, with a chunk


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

2006-03-31 Thread autrijus
Author: autrijus
Date: Fri Mar 31 07:02:49 2006
New Revision: 8511

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

Log:
* S06: note that all native types autobox to their uppercased
  counterparts. Nicholas++ for asking.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri Mar 31 07:02:49 2006
@@ -1244,10 +1244,11 @@
 
 =head1 Built-in Types
 
-These are some of the standard type names in Perl 6 (at least this week):
-
 =head2 Native types
 
+Values with these types autoboxes to their uppercase counterparts when
+you treat them as objects:
+
 bit single native bit
 int native signed integer
 uintnative unsigned integer (autoboxes to Int)


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

2006-03-12 Thread autrijus
Author: autrijus
Date: Sun Mar 12 05:15:15 2006
New Revision: 8122

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

Log:
* S12: private methods are no longer .:meth, but !meth.

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podSun Mar 12 05:15:15 2006
@@ -552,7 +552,7 @@
 @object».*meth(@args)  # calls all methods (0 or more) on each
 @object».+meth(@args)  # calls all methods (1 or more) on each
 @object».=meth(@args)  # calls mutator method on each
-@object».:meth(@args)  # calls private method on each
+@object»!meth(@args)   # calls private method on each
 
 Hyperoperators treat a junction as a scalar value, so saying:
 


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

2006-03-12 Thread autrijus
Author: autrijus
Date: Sun Mar 12 05:16:44 2006
New Revision: 8123

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

Log:
* S06: Patch from bsb++ to make macros hygienic by default,
  with TimToady++'s idea for q:code(:COMPILING) to denote
  unhygienicness.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSun Mar 12 05:16:44 2006
@@ -1985,6 +1985,11 @@
 return q:code  say $a +  $ast  
 return q:code ( say $a + ((( $ast ))) )
 
+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 /// /
+
 (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
@@ -1997,12 +2002,7 @@
 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
+Unquoted 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
@@ -2020,10 +2020,20 @@
 (Generally, a term expects a following postfix or infix operator,
 and an operator expects a following term or prefix operator.)
 
-A quasiquote is not a block (even if the delimiters are curlies),
-so any declaration of a variable is taken to be part of the block
-surrounding the macro call location.  Add your own {...} if you want
-a block to surround your declarations.
+Quasiquotes default to hygienic lexical scoping, just like closures.
+The visibility of lexical variables is limited to the q:code expression
+by default.  A variable declaration can be made externally visible using 
+the CCOMPILING:: pseudo-package.  Individual variables can be made visible,
+or all top-level variable declarations can be exposed using the
+Cq:code(:COMPILING) form.
+
+Both examples below will add C$new_variable to the lexical scope of
+the macro call:
+
+  q:code {  my $COMPILING::new_variable;   my $private_var; ... }
+  q:code(:COMPILING) { my $new_variable; { my $private_var; ... } }
+
+(Note that C:COMPILING has additional effects described in LMacros.) 
 
 =head1 Other matters
 


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

2006-02-28 Thread autrijus
Author: autrijus
Date: Tue Feb 28 07:22:23 2006
New Revision: 7898

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

Log:
* S05: Generalizing +$/ and ~$/ delegating to $(), by stipulating
  that all explicit coercion forms, except for boolean, dispatch
  from Match to its result object.

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podTue Feb 28 07:22:23 2006
@@ -588,6 +588,17 @@
 
 The closure is guaranteed to be run at the canonical time.
 
+An Bexplicit return from the closure binds the Iresult object for
+this match, ignores the rest of the current rule, and reports success:
+
+   / (\d) { return $0.sqrt } NotReached /;
+
+This has the effect of capturing the square root of the numified string,
+instead of the string.  The CNotReached part is not reached.
+
+These closures are invoked as anonymous methods on the CMatch object.
+See L/Match objects below for more about result objects.
+
 =item *
 
 A leading C interpolates the return value of a subroutine call as
@@ -1115,7 +1126,7 @@
 
 my $moose = m:{
 antler body
-{ return Moose.new( body = $body().attach($antler()) ) }
+{ return Moose.new( body = $body().attach($antler) ) }
 # match succeeds -- ignore the rest of the rule
 }.();
 
@@ -1131,6 +1142,16 @@
 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.
 
+Additionally, the CMatch object delegates its Ccoerce calls
+(such as C+$match and C~$match) to its underlying result object.
+The only exception is that CMatch handles boolean coercion itself,
+which returns whether the match had succeeded.
+
+This means that these two work the same:
+
+/ moose { $moose.() as Moose } /
+/ moose { $mooseas Moose } /
+
 =item *
 
 When used as an array, a Match object pretends to be an array of all


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

2006-02-26 Thread autrijus
Author: autrijus
Date: Sun Feb 26 01:32:17 2006
New Revision: 7874

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

Log:
* S11: Import from pseudo-packages like GLOBAL and CALLER.

Modified: doc/trunk/design/syn/S11.pod
==
--- doc/trunk/design/syn/S11.pod(original)
+++ doc/trunk/design/syn/S11.podSun Feb 26 01:32:17 2006
@@ -155,6 +155,21 @@
 require Sense;
 Sense.import;   # goes to the OUR scope by default, not MY
 
+=head1 Importing from a pseudo-package
+
+You may also import symbols from the various pseudo-packages listed in S02.
+They behave as if all their symbols are in the C:ALL export list:
+
+use GLOBAL $IN $OUT $ERR;
+require CALLER $x $y;
+
+# Same as:
+# my ($IN, $OUT, $ERR) ::= ($*IN, $*OUT, $*ERR)
+# my ($x, $y) := ($CALLER::x, $CALLER::y)
+
+As pseudo-packages are always already preloaded, Cuse and Crequire will
+never attempt to load, for example, CGLOBAL.pm from an external source.
+
 =head1 Versioning
 
 When at the top of a file you say something like


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

2006-02-26 Thread autrijus
Author: autrijus
Date: Sun Feb 26 01:35:45 2006
New Revision: 7875

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

Log:
* S06: Explicit importation in q:code// from the :COMPILING scope
  using the q:code(:COMPILING$x)// form.

* Also point out we can easily bind symbols at macro-run time,
  thanks to pseudo-package import in S11:

require COMPILING $x $y $z;


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSun Feb 26 01:35:45 2006
@@ -1865,7 +1865,7 @@
 mechanism using the quote Cq:code, followed by a block intended to
 represent an AST:
 
-return q:code { say $a };
+return q:code { say foo };
 
 Modifiers to the C:code adverb can modify the operation:
 
@@ -1873,11 +1873,42 @@
 :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
-unrecognized in that scope, are assumed to be bound from the scope
-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.
+Within a quasiquote, variable and function names resolve according
+to the lexical scope of the macro definition.  Unrecognized symbols raise
+errors when the macro is being compiled, Inot when it's being used.
+
+To make a symbol resolve to the (partially compiled) scope of the macro
+call, use the CCOMPILING:: pseudo-package:
+
+macro moose () { q:code { $COMPILING::x } }
+
+moose(); # macro-call-time error
+my $x;
+moose(); # resolves to 'my $x'
+
+If you want to mention symbols from the scope of the macro call, use the
+import syntax as modifiers to C:code:
+
+:COMPILING$x  # $x always refers to $x in caller's scope
+:COMPILING  # All free variables fallback to caller's scope
+
+If those symbols do not exist in the scope of the compiling scope, a
+compile-time exception is thrown at macro call time.
+
+Similarly, in the macro body you may either refer to the C$x declared in the
+scope of the macro call as C$COMPILING::x, or bind to them explicitly:
+
+my $x := $COMPILING::x;
+
+You may also use an import list to bind multiple symbols into the
+macro's lexical scope:
+
+require COMPILING $x $y $z;
+
+Note that you need to use the run-time C:= and Crequire forms, not C::=
+and Cuse, because the macro caller's compile-time is the macro's runtime.
+
+=head2 Splicing
 
 Bare AST variables (such as the arguments to the macro) may not be
 spliced directly into a quasiquote because they would be taken as


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

2006-02-26 Thread autrijus
Author: autrijus
Date: Sun Feb 26 07:45:08 2006
New Revision: 7876

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

Log:
* podchecking all the S*. 

Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSun Feb 26 07:45:08 2006
@@ -172,9 +172,9 @@
 When using a unary operator, only put it on the operand's side:
 
  @negatives = -« @positives;
- 
+
  @positions »++;# Increment all positions
- 
+
  @objects ».run();
  (f,oo,bar)».chars;   # (1,2,3)
 
@@ -263,7 +263,7 @@
 allowing multiple operands.
 
  if 3  $roll = 6  { print High roll }
- 
+
  if 1 = $roll1 == $roll2 = 6  { print Doubles! }
 
 Note: any operator beginning with C   must have whitespace

Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podSun Feb 26 07:45:08 2006
@@ -678,7 +678,7 @@
 
 print if $foo
 
-since C prefix:if  would hide C statement_modifier:if .
+since C prefix:if  would hide C statement_modifier:if .
 
 =head1 Smart matching
 

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podSun Feb 26 07:45:08 2006
@@ -1123,7 +1123,7 @@
 may be of any type, not just a string.
 
 You may also capture a subset of the match as the result object using
-the C (...) construct:
+the C (...)  construct:
 
 foo123bar ~~ / foo ( \d+ ) bar /
 say $();# says 123

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podSun Feb 26 07:45:08 2006
@@ -191,7 +191,7 @@
 
 my $lastval;
 sub lastval () is rw { return $lastval }
- 
+
 or the result of some nested call to an lvalue subroutine:
 
 sub prevval () is rw { return lastval() }
@@ -634,7 +634,7 @@
 so you can refer to it within the body. 
 
 sub foo(*%flag, [EMAIL PROTECTED]) {...}
-
+
 foo(:flag{ a = 1 }, :data[ 1, 2, 3 ]);
 # %flag has elements (flag = (a = 1)) and (data = [1,2,3])
 # @data has nothing
@@ -1027,9 +1027,9 @@
 my $addr := delete %guest_dataaddr;
 ...
 }
-   
 
+
 you can get the same effect with:
-   
 
+
 sub register ({:$name, :$addr, *%guest_data}, $room_num) {
 ...
 }

Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podSun Feb 26 07:45:08 2006
@@ -503,30 +503,30 @@
 single junction of the same species as the junctive argument.
 If two or more arguments are junctive, then the argument that is
 chosen to be autothreaded is:
-   
+
 =over
-   
+
 =item *
-   
+
 the left-most conjunction or injunction (if any), or else
-   
+
 =item *
-   
+
 the left-most abjunction or disjunction
-   
+
 =back
-   
+
 with the tests applied in that order.
-   
+
 Each of the resulting set of calls is then recursively autothreaded
 until no more junctive arguments remain. That is:
-   
+
substr(camel, 0|1, 23)
-   
+
 - all( substr(camel, 0|1, 2),  # autothread the conjunctive arg
substr(camel, 0|1, 3)
  )
-   
+
 - all( any( substr(camel, 0, 2),   # autothread the disjunctive arg
 substr(camel, 1, 2),
   ),
@@ -534,14 +534,14 @@
 substr(camel, 1, 3

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

2006-02-26 Thread autrijus
Author: autrijus
Date: Sun Feb 26 07:48:47 2006
New Revision: 7877

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

Log:
* S02: Non-qualified variables, such as $x and f, _always_
  refers to lexicals under default strictitude, because we
  can now say:

our $x; # brings from package scope
use GLOBAL $IN;   # brings from global scope


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podSun Feb 26 07:48:47 2006
@@ -240,6 +240,8 @@
 
 =head1 Names and Variables
 
+=over 4
+
 =item *
 
 The C$pkg'var syntax is dead.  Use C$pkg::var instead.
@@ -549,11 +551,26 @@
 then from inner packages to outer.  Variable names are searched
 for from inner lexical scopes to outer, but unlike package names
 are looked for in only the current package and the global package.
+
 The global namespace is the last place it looks in either case.
 You must use the C* (or CGLOBAL) package on the front of the
 string argument to force the search to start in the global namespace.
-Use the CMY pseudopackage to limit the scopes to lexical, and COUR
-to limit the scopes to package.
+
+Use the CMY pseudopackage to limit the lookup to the current lexical
+scope, and COUR to limit the scopes to the current package scope.
+
+=item *
+
+When strict is in effect (which is the default except for one-liners),
+non-qualified variables (such as C$x and C@y) are only looked up from
+lexical scopes, but never from package scopes.
+
+To bind package variables into a lexical scope, simply say Cour ($x, @y).
+To bind global variables into a lexical scope, predeclare them with Cuse:
+
+use GLOBAL $IN $OUT;
+
+Or just refer to them as C$*IN and C$*OUT.
 
 =item *
 


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

2006-02-25 Thread autrijus
Author: autrijus
Date: Sat Feb 25 01:59:19 2006
New Revision: 7867

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

Log:
* S05: Fix the (...) typo (was spelled (...\) and
  make the moose example slightly more idiomatic.

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podSat Feb 25 01:59:19 2006
@@ -1115,17 +1115,17 @@
 
 my $moose = m:{
 antler body
-{ return Moose.new( body = $body.attach(:$antler) ) }
+{ return Moose.new( body = $body().attach($antler()) ) }
 # 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.
+may be of any type, 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 /
+foo123bar ~~ / foo ( \d+ ) bar /
 say $();# says 123
 
 In this case the result object is always a string when doing string


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

2006-02-24 Thread autrijus
Author: autrijus
Date: Fri Feb 24 05:49:02 2006
New Revision: 7839

Modified:
   doc/trunk/design/syn/S02.pod
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S06.pod
Log:
* Textual cleanup of S2/4/6. No functional changes.
- Change sentences like Perl 6 will support to Perl 6 supports
- References to A* becomes S0*.
- Make it clear that ::Foo.bar() does not interpolate in strings.
- The .each in S06 was actually a thinko for .map.

Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podFri Feb 24 05:49:02 2006
@@ -111,22 +111,23 @@ be trivial to declare them as a macro).
 =item *
 
 In support of OO encapsulation, there is a new fundamental datatype:
-opaque.  External access to opaque objects is always through method
+Bopaque.  External access to opaque objects is always through method
 calls, even for attributes.
 
 =item *
 
-Perl 6 will have an optional type system that helps you write safer
+Perl 6 has an optional type system that helps you write safer
 code that performs better.  The compiler is free to infer what type
 information it can from the types you supply, but will not complain
 about missing type information unless you ask it to.
 
 =item *
 
-Perl 6 will support the notion of properties on various kinds of
+Perl 6 supports the notion of Bproperties on various kinds of
 objects.  Properties are like object attributes, except that they're
 managed by the individual object rather than by the object's class.
-According to A12, properties are actually implemented by a
+
+According to S12, properties are actually implemented by a
 kind of mixin mechanism, and such mixins are accomplished by the
 generation of an individual anonymous class for the object (unless
 an identical anonymous class already exists and can safely be shared).
@@ -134,7 +135,7 @@ an identical anonymous class already exi
 =item *
 
 Properties applied to compile-time objects such as variables and
-classes are also called traits.  Traits are not expected to change
+classes are also called Btraits.  Traits are not expected to change
 at run time.  Changing run-time properties should be done via mixin
 instead, so that the compiler can optimize based on declared traits.
 
@@ -150,7 +151,7 @@ than in Perl 5.
 A variable's type is an interface contract indicating what sorts
 of values the variable may contain. More precisely, it's a promise
 that the object or objects contained in the variable are capable of
-responding to the methods of the indicated role.  See A12 for more
+responding to the methods of the indicated role.  See S12 for more
 about roles.  A variable object may itself be bound to a container
 type that specifies how the container works without necessarily
 specifying what kinds of things it contains.
@@ -158,15 +159,16 @@ specifying what kinds of things it conta
 =item *
 
 You'll be able to ask for the length of an array, but it won't be
-called that, because length does not specify units.  So
-C.elems is the number of array elements.  (You can also
+called that, because Clength does not specify units.  So
+C.elems is the number of array elements.  You can also
 ask for the length of an array in bytes or codepoints or graphemes.
-Same for strings.  There is no C.length on strings either.)
+The same methods apply to strings as well: there is no C.length on
+strings either.
 
 =item *
 
 Cmy Dog $spot by itself does not automatically call a CDog constructor.
-The actual constructor syntax turns out to be Cmy Dog $spot.=new;,
+The actual constructor syntax turns out to be Cmy Dog $spot .= new;,
 making use of the C.= mutator method-call syntax.
 
 =item *
@@ -194,7 +196,7 @@ than the native type can speed it up.)
 
 =item *
 
-All Object types support the undefined role, and may contain an
+All Object types support the Cundefined role, and may contain an
 alternate set of attributes when undefined, such as the unthrown
 exception explaining why the value is undefined.  Non-object types
 are not required to support undefinedness, but it is an error to
@@ -209,7 +211,7 @@ used as a kind when the context requir
 
 =item *
 
-Perl 6 will intrinsically support big integers and rationals through
+Perl 6 intrinsically supports big integers and rationals through
 its system of type declarations.  CInt automatically supports
 promotion to arbitrary precision.  CRat supports arbitrary precision
 rational arithmetic.  Value types like Cint and Cnum imply
@@ -227,10 +229,10 @@ on overflow.
 
 =item *
 
-A CStr is a Unicode string object of some sort.  A Cstr is
-a stringish view of an array of integers, and has no Unicode or
-character properties without explicit conversion to some kind of CStr.
-Typically it's an array of bytes serving as a buffer.
+A CStr is a Unicode string object.  A Cstr is a stringish view of
+an array of integers, and has

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

2006-02-24 Thread autrijus
Author: autrijus
Date: Fri Feb 24 10:58:18 2006
New Revision: 7849

Modified:
   doc/trunk/design/syn/S06.pod
   doc/trunk/design/syn/S10.pod
   doc/trunk/design/syn/S13.pod
Log:
* more A*-S* changes.

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podFri Feb 24 10:58:18 2006
@@ -1443,7 +1443,7 @@ The Cbut INAME (IDATA) syntax spec
 return 0 but true;
 }
 
-Properties are predeclared as roles and implemented as mixins--see A12.
+Properties are predeclared as roles and implemented as mixins--see S12.
 
 =head2 Subroutine traits
 

Modified: doc/trunk/design/syn/S10.pod
==
--- doc/trunk/design/syn/S10.pod(original)
+++ doc/trunk/design/syn/S10.podFri Feb 24 10:58:18 2006
@@ -119,7 +119,7 @@ These routines are expected to define th
 it, since the call is already scheduled from somewhere else.
 (The Cgoto $AUTOLOAD is implicit, in other words.  But you can
 hijack the call via the Ccall builtin, in which case the autoloader
-behaves just like a wrapper--see A6.)
+behaves just like a wrapper--see S06.)
 
 In any case, there is no longer any magical C$AUTOLOAD variable.
 The name being declared or defined can be found in C$_

Modified: doc/trunk/design/syn/S13.pod
==
--- doc/trunk/design/syn/S13.pod(original)
+++ doc/trunk/design/syn/S13.podFri Feb 24 10:58:18 2006
@@ -39,7 +39,7 @@ any trickery involving swapping the argu
 type instead of the left one.  And there's no longer any need to
 examine a special flag to see if the arguments were reversed.
 
-For much more about multiple dispatch, see A12.
+For much more about multiple dispatch, see S12.
 
 =head1 Syntax
 


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

2006-02-24 Thread autrijus
Author: autrijus
Date: Fri Feb 24 12:21:45 2006
New Revision: 7853

Modified:
   doc/trunk/design/syn/S04.pod
Log:
* S04: The If a curly occurs by a line by itself, then it
  stands for end of statement rule from A04 is brought
  foward and further generalized -- now it only has to be
  at the end of line.  This allows:

# semicolon optional after an end-of-line brace 
try { ... }
another_expression;

  and forbids:

# comma needed between two subs
sub f { ... } sub g { ... }


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podFri Feb 24 12:21:45 2006
@@ -12,9 +12,9 @@ Larry Wall [EMAIL PROTECTED]
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 19 Aug 2004
-  Last Modified: 31 Jan 2006
+  Last Modified: 24 Feb 2006
   Number: 4
-  Version: 8
+  Version: 9
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -92,6 +92,33 @@ value will be restored only if the curre
 or hypotheticalize the value or the variable depending on whether you
 do assignment or binding.
 
+=head1 Statement-ending blocks
+
+A line ending with a closing brace C}, followed by nothing but
+whitespace or comments, will terminates statement if an end of statement
+can occur there.  That is, these two statements are equivalent:
+
+my $x = sub { 3 }
+my $x = sub { 3 };
+
+End-of-statement cannot occur within a bracketed expression, so
+this still works:
+
+my $x = [
+sub { 3 },  # this comma is not optional
+sub { 3 }   # the statement won't terminate here 
+];
+
+Because subroutine declarations are expressions, not statements,
+this is now invalid:
+
+sub f { 3 } sub g { 3 } # two terms occur in a row
+
+But these two are valid:
+
+sub f { 3 }; sub g { 3 };
+sub f { 3 }; sub g { 3 }# the trailing semicolon is optional
+
 =head1 Conditional statements
 
 The Cif and Cunless statements work almost exactly as they do in


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

2006-02-24 Thread autrijus
Author: autrijus
Date: Fri Feb 24 14:16:49 2006
New Revision: 7858

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

Log:
* S09: Autovivification no longer happens under rvalue context.
  Suggested and contributed by Yuval Kogman.

Modified: doc/trunk/design/syn/S09.pod
==
--- doc/trunk/design/syn/S09.pod(original)
+++ doc/trunk/design/syn/S09.podFri Feb 24 14:16:49 2006
@@ -672,3 +672,33 @@
 a list of keys, the size of which is the number of declared dimensions
 of the hash.  [XXX but this seems to imply another lookup to find the
 value.  Perhaps the associated value can also be bundled in somehow.]
+
+=head1 Autovivification
+
+Autovivification will only happen if the vivifiable path is used as a
+container, by binding, assigning, or taking a reference. On the other hand,
+value extraction does not autovivify.
+
+This is as opposed to Perl 5, where autovivification could happen
+unintentionally, even when the code looks like a non-destructive test:
+
+my %hash;
+exists $hash{foo}{bar}; # creates $hash{foo} as an empty hash reference
+
+In Perl 6 these read-only operations are indeed non-destructive:
+
+my %hash;
+exists $hash{foo}{bar}; # %hash is still empty
+
+But these ones Ido autovivify:
+
+my %hash;
+my $val := $hash{foo}{bar};
+
+my @array;
+my $ref = \$array[0][0];
+
+my %hash;
+$hash{foo}{bar} = foo; # duh
+
+This rule applies to dereferencing arrays, hashes, and scalar references.


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

2006-02-24 Thread autrijus
Author: autrijus
Date: Fri Feb 24 15:05:03 2006
New Revision: 7859

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

Log:
* returning from within a rule sets the result object,
  which can be accessed with the .() dereferencer.

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podFri Feb 24 15:05:03 2006
@@ -13,9 +13,9 @@
 
Maintainer: Patrick Michaud [EMAIL PROTECTED]
Date: 24 Jun 2002
-   Last Modified: 2 Feb 2006
+   Last Modified: 24 Feb 2006
Number: 5
-   Version: 9
+   Version: 10
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them rules because they haven't been
@@ -1063,7 +1063,8 @@
 
 =item *
 
-In string context it evaluates to the entire matched string:
+In string context it evaluates to the stringified value of its
+Iresult object, which is usually the entire matched string:
 
  print %hash{ {$text ~~ /?ident/} };
  # or equivalently:
@@ -1073,8 +1074,8 @@
 
 =item *
 
-In numeric context it evaluates to the numeric value of the entire matched
-string:
+In numeric context it evaluates to the numeric value of its
+Iresult object, which is usually the entire matched string:
 
  $sum += /\d+/;
  # or equivalently:
@@ -1082,8 +1083,20 @@
 
 =item *
 
-When used as an array, C$/ pretends to be an array containing
-C$0, C$1, etc.  Hence
+When used 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 Creturn inside a rule:
+
+my $moose = m:{
+antler body
+{ return Moose.new( body = $body.attach(:$antler) ) }
+# match succeeds -- ignore the rest of the rule
+}.();
+
+=item *
+
+When used as an array, a Match object pretends to be an array of all
+its positional captures.  Hence
 
  ($key, $val) = m:w/ (\S+) = (\S+)/;
 
@@ -1105,7 +1118,7 @@
 
 =item *
 
-When used as a hash, C$/ pretends to be a hash of all the named
+When used as a hash, a Match object pretends to be a hash of all its named
 captures.  The keys do not include any sigils, so if you capture to
 variable C @foo  its real name is C$/{'foo'} or C $/foo .
 However, you may still refer to it as C @foo  anywhere C$/


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

2006-02-23 Thread autrijus
Author: autrijus
Date: Wed Feb 22 11:01:51 2006
New Revision: 7784

Modified:
   doc/trunk/design/syn/S12.pod
Log:
* S12: replace the inaccurate use eigenclass with metaclass
* Also specify $.foo and $.foo(...) forms as contextful
  shorthands of method calls on self.

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podWed Feb 22 11:01:51 2006
@@ -303,16 +303,16 @@ pass it a prototype object such as Dog
 object is, as long as the method body doesn't try to access any information 
that
 is undefined in the current instance.
 
-Alternately, you can associate a class method with the current eigenclass 
instance,
+Alternately, you can associate a class method with the current metaclass 
instance,
 which as a singleton object knows your package, and can function as a more 
traditional
 class method:
 
 our $count;
 method ^count { return $count }
 
-Such an eigenmethod is delegated to C.meta just as method like .does are,
-so it's possible to call this as CDog.count or C$dog.count.  However,
-best practice is probably to call such a class method as CDog.^count
+Such an Imetaclass method is always delegated to C.meta just as method like
+C.does are, so it's possible to call this as CDog.count or C$dog.count.
+However, best practice is probably to call such a class method as CDog.^count
 or C$dog.^count to make it clear that it's in its own namespace separate
 from ordinary methods, and so that your class method cannot be accidentally
 overridden by an ordinary method in a subclass--presuming you don't want to
@@ -377,12 +377,25 @@ directly to the attribute values.  Outsi
 only access to attributes is through the accessors since an object has
 to be specified.  The dot form of attribute variables may be used in
 derived classes because the dot form always implies a virtual accessor
-call.  Every dot declaration also declares a corresponding private
-exclamation storage location, and the exclamation form may be used
+call.  Every Idot declaration also declares a corresponding private
+Iexclamation storage location, and the exclamation form may be used
 only in the actual class, not in derived classes.  Reference to the
 internal storage location via C$!foo should generally be restricted
 to submethods.  Ordinary methods should stick to the C$.foo form.
 
+Because C$.foo, C@.foo, C%.foo, C.foo are just shorthands of
+Cself.foo with different contexts, the class does not need to declare Chas
+$.foo as a property -- a Cmethod foo declaration can work just as well.
+
+The dot form can take an argument list as well.  These are all equivalent:
+
+self.foo(1,2,3);# a regular method call
+self.foo.(1,2,3);   # ditto
+$.foo(1,2,3);   # calls self.foo under $ context
+$.foo.(1,2,3);  # ditto
+@.foo(1,2,3);   # calls self.foo under @ context
+@.foo.(1,2,3);  # ditto
+
 Pseudo-assignment to an attribute declaration specifies the default
 value.  The value on the right is evaluated at class composition
 time, that is, while the class is being compiled and the class


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

2006-02-23 Thread autrijus
Author: autrijus
Date: Thu Feb 23 13:25:31 2006
New Revision: 7812

Modified:
   doc/trunk/design/syn/S11.pod
Log:
* S11: Inner modules can now decalare is export as well;
  exports are now collected with the inner ::EXPORT module,
  with tagsets as inner modules within it; use can now
  re-export the symbols with :EXPORT.

Modified: doc/trunk/design/syn/S11.pod
==
--- doc/trunk/design/syn/S11.pod(original)
+++ doc/trunk/design/syn/S11.podThu Feb 23 13:25:31 2006
@@ -77,13 +77,34 @@ Module traits are set using Cis:
 
 Exportation is now done by trait declaration on the exportable item:
 
-   # Tagset...
+module Foo;# Tagset...
 sub foo is export(:DEFAULT) {...}  #  :DEFAULT, :ALL
 sub bar is export(:DEFAULT :others) {...}  #  :DEFAULT, :ALL, :others
 sub baz is export(:MANDATORY)   {...}  #  (always exported)
 sub bop is export   {...}  #  :ALL
 sub qux is export(:others)  {...}  #  :ALL, :others
 
+Declarations marked as Cis export are bound into the CEXPORT inner
+modules, with their tagsets as inner module names within it.  For example,
+the Csub bar above will bind as CFoo::EXPORT::DEFAULT::bar,
+CFoo::EXPORT::ALL::bar, and CFoo::EXPORT::others::bar.
+
+Inner modules automatically add their export list to modules in its
+all outer scope:
+
+module Foo {
+sub foo is export {...}
+module Bar {
+sub bar is export {...}
+module Baz {
+sub baz is export {...}
+}
+}
+}
+
+The CFoo module will export Cfoo, Cbar and Cbaz by default;
+calling CFoo::Bar.import will import Cbar and Cbaz at runtime.
+
 =head1 Compile-time Importation
 
 Importing via Cuse binds into the current lexical scope by default
@@ -102,6 +123,12 @@ That's pretty much equivalent to:
 our @horse ::= @Sense::horse;
 $*warming  ::= $Sense::warming;
 
+It is also possible to re-export the imported symbols:
+
+use Sense :EXPORT;  # import and re-export the defaults
+use Sense common :EXPORT; # import common and re-export it
+use Sense common :EXPORT@horse; # import common but exports @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
 tags as arguments to Cis export.  (Of course, mixing incompatible scoping


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

2006-02-23 Thread autrijus
Author: autrijus
Date: Thu Feb 23 13:35:36 2006
New Revision: 7814

Modified:
   doc/trunk/design/syn/S11.pod
Log:
* S11 typo fix and version bump.

Modified: doc/trunk/design/syn/S11.pod
==
--- doc/trunk/design/syn/S11.pod(original)
+++ doc/trunk/design/syn/S11.podThu Feb 23 13:35:36 2006
@@ -14,7 +14,7 @@ Larry Wall [EMAIL PROTECTED]
   Date: 27 Oct 2004
   Last Modified: 22 Feb 2006
   Number: 11
-  Version: 7
+  Version: 8
 
 =head1 Overview
 
@@ -89,8 +89,8 @@ modules, with their tagsets as inner mod
 the Csub bar above will bind as CFoo::EXPORT::DEFAULT::bar,
 CFoo::EXPORT::ALL::bar, and CFoo::EXPORT::others::bar.
 
-Inner modules automatically add their export list to modules in its
-all outer scope:
+Inner modules automatically add their export list to modules in all their
+outer scopes:
 
 module Foo {
 sub foo is export {...}


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

2006-02-23 Thread autrijus
Author: autrijus
Date: Thu Feb 23 17:02:39 2006
New Revision: 7831

Modified:
   doc/trunk/design/syn/S11.pod
   doc/trunk/design/syn/S12.pod
Log:
* S11: fix another typo. Typo`R`us.
* S12: remove the remaining eigenclass misnomer when it means metaclass.

Modified: doc/trunk/design/syn/S11.pod
==
--- doc/trunk/design/syn/S11.pod(original)
+++ doc/trunk/design/syn/S11.podThu Feb 23 17:02:39 2006
@@ -295,7 +295,7 @@ version number or other literal:
 6;
 Coolness, dude!;
 
-it runs Perl 6 in lax mode, without strictures or warnings, since obvously
+it runs Perl 6 in lax mode, without strictures or warnings, since obviously
 a bare literal in a void context Iought to have produced a warning.
 (Invoking perl with C-e6 has the same effect.)
 

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podThu Feb 23 17:02:39 2006
@@ -134,7 +134,7 @@ metaclass chooses to dispatch the .defin
 
 The notation C^Dog is syntactic sugar for CDog.meta, so C^ can be
 considered the class sigil when you want to talk about the current
-eigenclass instance.
+metaclass instance.
 
 Classes are open and non-final by default, but may easily be closed
 or finalized not by themselves but by the entire application, provided


Re: Parrot and PGE will save the day (was Re: as if [Was: Selective reuse of storage in bless.] )

2006-01-21 Thread Audrey Tang (autrijus)
On 1/21/06, Rob Kinyon [EMAIL PROTECTED] wrote:
 I'm making a few assumptions here:
 1) Since PGE isn't part of Perl6 (because it's written in PIR), it
 can be used as the parser/lexer/etc. for any language, not just Perl6.

Rules, like regexes, are essentially language neutral. So that's true.

 2) Since PGE can be lexically-scoped, one can change the entire
 grammar within a given block, including how variables are referenced,
 subroutines are called, etc.

The grammar only governs the surface syntax. It does not automagically
control semantics (e.g. whether .arguments are available, tying, blessing,
et cetera).

Moreover, writing a Perl 5 parser in PGE alone is... Very difficult.
It can be done (eg. PPI), but taking it and emit PIR is a nontrivial
task that would not magically happen.

 3) Since everything is, at the heart, just a PMC, so long as the
 appropriate PIR is emitted, it doesn't matter how the userside code is
 written so long as the right parser/lexer/whatever is used to
 translate it to PIR.

Again, that'd be handwaving, as Perl5-PIR compiler is currently
not championed by anybody.  The slightly less ambitious Perl5-PMCs
project (Ponie) is also in need of a champion at this moment, and
it does not guarantee sane interoperation with other PIR targetting
compilers in itself, though we are certainly working on it.

 So, if all three assumptions hold, then your monolithic Perl5 script
 can easily inline any Parrot-targeted language you want, simply by
 doing the following:
 1) Use Ponie.
 2) Within a block, import the appropriate PGE module(s) to
 redefine the grammar to P6 and do what you need to do.

 No translator needed.

The amount of effort of writing all this is no less heavy than that of a
Perl5-to-Perl6 translator. :-)  Also it makes sense to have multiple
migration paths (runtime-level, bytecode-rewriting-level, source
recompilation level), because different people are interested in different
subprojects.

The P5-to-P6 translator also could work when targetting the JavaScript
runtime, or the CLR runtime, or generating native code via LLVM or D;
in those places Ponie does not help at all.

Audrey


Re: as if [Was: Selective reuse of storage in bless.]

2006-01-20 Thread Audrey Tang (autrijus)
On 1/21/06, Larry Wall [EMAIL PROTECTED] wrote:
 But maybe all this is already possible in the current setup, if

 role ObjectFakeHash does Hash {...}
 role Object does ObjectFakeHash {...}
 class Hash does Hash {...}

Yes, I think that's the way to go, as well as :coerceas for explicit
class-based (instead of role-based) conversions.

Audrey


Re: Class methods vs. Instance methods

2006-01-19 Thread Audrey Tang (autrijus)
On 1/19/06, Matt Fowles [EMAIL PROTECTED] wrote:
 Could you provide a concrete example of the advantage of this approach
 please?  Failing that can you try and expand on your gut feeling a
 bit?

May or may not be of use, but Larry's view sounds a bit like reconcilling the
(again considered irreconcilable) gap between nominal and structural subtyping:

http://cakoose.com/wiki/type_system_terminology#13

Where the empty class object is the degenerate case of the smallest possible
structural type, so it can be fulfilled by anything more structurally
rich as long
as they share the same nominal constraint.

Audrey


Re: Avoid the Yen Sign [Was: Re: new sigil]

2005-10-23 Thread Autrijus Tang
Dan Kogai wrote:
 To make the matter worse, there are not just one yen sign in  Unicode.
 Take a look at this.

 ¥ U+00A5 YEN SIGN
 ¥ U+FFE5 FULLWIDTH YEN SIGN

 Tough they look and groks the same to human, computers handle them
 differently.  This happened when Unicode Consortium decided to make  BMP
 round-trippable against legacy encodings.  They were distinct in  JIS
 standards, so happened Unicode.

In addition to your handy table, the  and  french quotes, which are used
quite heavily in Perl 6 for both bracketing and hyper operators, also have
full width equivalents:

300A;LEFT DOUBLE ANGLE BRACKET;Ps;0;ON;Y;OPENING DOUBLE ANGLE BRACKET
300B;RIGHT DOUBLE ANGLE BRACKET;Pe;0;ON;Y;CLOSING DOUBLE ANGLE BRACKET

Half width: «»
Full width: 《》

There is no way to type out the half-width yen and double angle brackets under
MSWin32, under either the traditional or simplified code pages; only full width
variants are available.

One way to approach it is to make Perl 6 accept both full- and
half-width variants.

Another way would be to use ASCII fallbacks exclusively in real programs, and
reserve unicode variants for pretty-printing, the same way that PLT Scheme and
Haskell recognizes λ in literatures, but actually write lambda and
\ respectively
in everyday coding.

TIMTOWTDI. :)

Thanks,
/Autrijus/


Re: new sigil

2005-10-22 Thread Autrijus Tang
Juerd wrote:
 I do not see why $ and @ couldn't be both a sigil and an infix
 operator, and the same goes for whatever ASCII equivalent ¢ gets.
 
 ^ and | are available for sigil use. (All the closing brackets are too,
 but that would be very confusing because we tend to visually parse those
 in pairs.)
 
 Using the an infix operator's symbol as a sigil is not weird, not wrong,
 not confusing and mostly: not a new idea.

Indeed.  Somehow I think this makes some sense:

sub Bool eqv (|T $x, |T $y) { ... }

Thanks,
/Autrijus/


Re: Complex types

2005-10-12 Thread Autrijus Tang

Larry Wall wrote:

On Thu, Oct 13, 2005 at 09:43:15AM +1300, Sam Vilain wrote:
: Hi all,
: 
: Is it intentional that S09 lists unboxed complex types, but equivalent

: Boxed types are missing from the Types section in S06?

Nope.


As it's a trivial omission, I went ahead and changed S06.pod (r6201).

Thanks,
/Autrijus/


Re: A listop, a block and a dot

2005-10-05 Thread Autrijus Tang

Luke Palmer wrote:

With parentheses:

print((length foo)  4)
print(3  4)

So this was quite a disturbing bug.


This is now also quite a fixed bug. :-)

However:
f:{1}.()

still parses as

(f(:{1})).()

as the adverbial block form takes precedence.  Is that also wrong?

/Autrijus/


Re: FYI: Lambda Calculus on Perl 6

2005-09-05 Thread Autrijus Tang
On Mon, Sep 05, 2005 at 12:35:36PM +0900, Dan Kogai wrote:
 And I found that these can be made much, much simpler and more  
 intuitive with Perl 6, even more so than scheme!
 
   our $ZERO = sub($f){ sub($x){ $x }};
   our $SUCC = sub($n){ sub($f){ sub($x){ $f.($n.($f)($x)) }}};
   our $ADD  = sub($m){ sub($n){ sub($f){ sub($x){ $m.($f)($n.($f) 
 ($x)) ;
   our $MULT = sub($m){ sub($n){ sub($f){ $m.($n.($f)) }}};
   our $POW  = sub($m){ sub($n){ $n.($m) }};

Nice!  Also the pointy notation may or may not be clearer:

- $f { - $x { $x } }

Also, you can use the  sigil:

our SUCC := sub(n){ sub(f){ sub(x){ f(n(f)(x)) }}};

which may or may not be clearer... probably not, come to think about it.

 P.S.  I am surprised to find Pugs does not include this kind of  
 sample scripts.

I'm surprised to find dan-san is not a Pugs committer.  I've remedied
this situation by sending you an invitation.  The commit URL is the
same as the anonymous checkout svn URL.

Please commit them into the suitable examples/ subdirectory, probably
algorithms.  Also please add yourself to AUTHORS.  Welcome aboard!

Thanks,
/Autrijus/


pgpERLqoLpAGo.pgp
Description: PGP signature


Re: Who is @Larry?

2005-08-25 Thread Autrijus Tang
On Thu, Aug 25, 2005 at 09:25:30PM -0400, Matt Fowles wrote:
 I have a simple question.  Who comprises @Larry?  I am fairly sure
 that I know a few people in it, but I am highly doubtful that I know
 all of them.

dev.perl.org has a Who's Who list:

http://dev.perl.org/perl6/people.html

The Architecture team is comprised of:

 larry damian chip leo chromatic allison hugo luke nathan dan 

Thanks,
/Autrijus/


pgptVEZlu8p04.pgp
Description: PGP signature


Re: Hoping that Params::Validate is not needed in Perl6

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 10:02:23AM -0700, chromatic wrote:
 On Wed, 2005-08-17 at 23:43 -0500, Dave Rolsky wrote:
 
  But I'd really like to get this stuff done at compile time wherever 
  possible.  If I write this:
  
 validate( credit_card_number: $number );

BTW, the colon is on the left:

:credit_card_number($number)

  it should blow up at compile time, right?
 
 Does that depend on how closed you want Perl 6 to think your world is at
 compile time?

Right, because introducing new multi variant at runtime is a
desired feature.  Which is why I think closed should not be
limited to classes, but should extend to packages as well...

Thanks,
/Autrijus/


pgpx5jRaNhflL.pgp
Description: PGP signature


Re: my $pi is constant = 3;

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 10:09:16AM -0700, Larry Wall wrote:
 In other words, you could desugar
 
 sub foo ($a = 1) {...}
 
 to
 
 sub foo ($a) {
   $a = 1 unless exists $a;
   ...
 }

I like this.  Can we go for it, at least for this week? :)

Thanks,
/Autrijus/


pgp7xakdZfrUu.pgp
Description: PGP signature


Re: my $pi is constant = 3;

2005-08-18 Thread Autrijus Tang
On Fri, Aug 19, 2005 at 01:15:23AM +0800, Autrijus Tang wrote:
 On Thu, Aug 18, 2005 at 10:09:16AM -0700, Larry Wall wrote:
  In other words, you could desugar
  
  sub foo ($a = 1) {...}
  
  to
  
  sub foo ($a) {
  $a = 1 unless exists $a;
  ...
  }
 
 I like this.  Can we go for it, at least for this week? :)

Also, preemptively -- I think the corresponding delete $a is insane,
as it would just lift up the constancy problem one level, defeating the
no rebinding restriction.

Thanks,
/Autrijus/


pgp3J1ypKaNbp.pgp
Description: PGP signature


Re: Serializing code

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 08:22:20PM +0300, Yuval Kogman wrote:
  sub foo { $?DOM.document.write(...) } 
  BEGIN { foo() };   # error, there's no $?DOM object 
 # at compile-time! 
 
 Unless you're compiling in the browser ;-)

Which... is possible, and that's how I plan to support eval().

Thanks,
/Autrijus/


pgpWnA4i8m2hN.pgp
Description: PGP signature


Re: my $pi is constant = 3;

2005-08-18 Thread Autrijus Tang
On Thu, Aug 18, 2005 at 10:26:00AM -0700, Larry Wall wrote:
 Sure.  Though it probably also wants to stay as metadata associated
 with the signature, since part of the reason for putting it in
 the signature in the first place is so that optimizers can install
 constants on the caller end, at least for ordinary sub calls.  Also,
 desugaring a predeclaration would tend to cloak the yadae at the end,
 but maybe that's not a problem unless you use the presence of bare
 yadae in the body to suppress redefinition warnings.

The full desugared form is, I think:

our foo;  # lifted to beginning of package!
...
BEGIN {
foo := a Sub is stub {
($a) := ?Internals::GETARGS();
$a = 1 unless exists $a;
# real body begins here
...
};
}

with the is stub -- not neccessarily exposed to the user level --
filled in by a parser rule, i.e. a predefined macro.

Does this sound sane?

Thanks,
/Autrijus/


pgpVR42LVke0G.pgp
Description: PGP signature


Re: my $pi is constant = 3;

2005-08-18 Thread Autrijus Tang
On Fri, Aug 19, 2005 at 01:36:30AM +0800, Autrijus Tang wrote:
 BEGIN {
   foo := a Sub is stub {
   ($a) := ?Internals::GETARGS();
   $a = 1 unless exists $a;
   # real body begins here
   ...
   };
 }

Er, sorry, the ($a) would need a my() scope identifier, as with all
parameters and hoisted mid-block my() declarations.

Also, a Sub should read a sub.

Thanks,
/Autrijus/


pgp58rqXRSVNR.pgp
Description: PGP signature


Re: my $pi is constant = 3;

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 08:47:18AM -0700, Larry Wall wrote:
 : That could be made to work by defining constant to mean you can assign
 : to it if it's undefined.  But then it gets a little harder to reason
 : about it if $pi can later become undefined.  I suppose we could
 : disallow undefine($pi) though.

If you can assign it when it contains an undefined value, bad
things happen:

sub f ($x is readonly) { $x = 10 }
my $a; f($a);

Compare this with:

my $x is readonly;
$x = 10;

If it is defined as bound to a immutable value cell, both cases
above would fail, which is imho the easiest to explain.

 You could still reason about it if you can determine what the initial
 value is going to be.  But certainly that's not a guarantee, which
 is one of the reasons we're now calling this write/bind-once behavior
 readonly and moving true constants to a separate declarator:
 
 my $pi is readonly;
 $pi = 3;

The question remains, whether you can bind the readonliness away:

my $pi is readonly; # undef at this point
my $e is rw = 2.7;
$pi := $e;
$pi = 9;

I can argue both sides -- rebindable is easier to implement, but
non-rebindable is perhaps more intuitive.

Thanks,
/Autrijus/


pgpiwWL9pRQuS.pgp
Description: PGP signature


Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 11:37:26AM -0700, Larry Wall wrote:
 On Tue, Aug 16, 2005 at 05:25:40PM -0400, Roger Hale wrote:
 : 1.e5# all of these...
 : 1._e5   #
 : 1._0e5  #
 : 1.e_0_5_# == 1 * 10^5?
 
 The last three are illegal because underline is allowed only between
 digits.

...yet Perl5 accepts them.  So Perl6 is more restrictive?

(Which is good, because that's how Pugs currently implements them)

Thanks,
/Autrijus/


pgpTQGinWkn5k.pgp
Description: PGP signature


Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 11:45:52PM -0500, Dave Rolsky wrote:
 And another question.  How will I make Perl6 not do automatic coercion for 
 me.  If I have this sub:
 
  sub date (Int +$year is required, +$month, +$day)

BTW, Pugs supports the ++ syntax, which iirc is said to be back in favour
during the Oscon design meeting:

sub date (Int ++$year, +$month, +$day)

 and someone does this:
 
  date('this year', 12, 1);
 
 I'd prefer for this to fail, rather than giving me -12-01!  I vaguely 
 remember a mention of use strict 'types' either on this list or hanging 
 out with some pugs folks at YAPC.

You will probably get:

1. a compile time warning of unsafe coercion, possibly made fatal.
and 
2. a NaN at runtime if you ignore the warning.

Thanks,
/Autrijus/


pgpHXV9csSalC.pgp
Description: PGP signature


Type inferencing for Perl5

2005-08-16 Thread Autrijus Tang
On Tue, Aug 16, 2005 at 02:04:41PM +0100, Nicholas Clark wrote:
 On Thu, Aug 11, 2005 at 01:35:14AM +0800, Autrijus Tang wrote:
  On Wed, Aug 10, 2005 at 07:32:01PM +0200, TSa wrote:
   Counting the sigil quadriga as 4, what is the fifth element?
   @ $ % :: 
  In Perl5, :: is replaced by *.
 
 Strictly in Perl 5 there are 7 types
 SCALAR, ARRAY, HASH, CODE, GLOB, FORMAT and IO.
 
 (where IO might actually be 2 types, file handles and directory handles,
 and in turn FORMAT is implemented as a subtype of CODE.

 Also, internally there are 16 variants of SV*, with mostly a 1 to 1 mapping
 for all the types except SCALAR, which sort of absorbs the other 10. Except
 that the null SV type is easily directly morphable into any of the others.

It would be great if we can use a type-directed transform from Perl 5
syntax tree into PIL/Perl6, i.e. annotate each term with the 16
variants, maybe with union/intersection types that represents ambiguous
context, such as:

f(reverse(g()));

Hm, I seem to remember that Gary Jackson (cc'ed) is working on that,
as his Summer of Code project.  Gary, can you share with us how you
plan to approach that, and/or how to get involved to your project?

Thanks,
/Autrijus/


pgpjNvj5wXL3I.pgp
Description: PGP signature


Re: Time::Local

2005-08-16 Thread Autrijus Tang
On Tue, Aug 16, 2005 at 08:37:24AM -0700, Larry Wall wrote:
 : But that's in contrast to your saying that the epoch would be December 31, 
 : 1999 at 23:59:29.0 UTC.  Or did I misread your earlier messages?
 
 Yes, you misread it.  I was angling for 00:00:00.0 UTC.  But it scarcely
 matters if UTC keeps screwing around with leap seconds, and civil time
 stays locked to UTC.  I personally think we should add a bunch of leap
 seconds at the beginning of every year divisible by 100, and leave the
 rest of the years alone.

...This seems to be quite consistent with the rumoured US proposal to
abolish leap seconds by adding leap hours every 500 years or so:

http://www.post-gazette.com/pg/05210/545823.stm

Ending leap seconds would make the sun start rising later and later by the
clock -- a few seconds later each decade. To compensate, the U.S. has
proposed adding in a leap hour every 500 to 600 years, which also
accounts for the fact that the Earth's rotation is expected to slow down
even further. That would be no more disruptive than the annual switch to
daylight-saving time, said Ronald Beard of the Naval Research Laboratory,
who chairs the ITU's special committee on leap seconds and favors their
abolishment. It's not like someone's going to be going to school at four
in the afternoon or something, he said.

Thanks,
/Autrijus/


pgpsTEMTIuNi9.pgp
Description: PGP signature


Re: Generic classes.

2005-08-16 Thread Autrijus Tang
On Mon, Aug 15, 2005 at 11:07:51AM -0700, Larry Wall wrote:
 Sure, except that you're not really inheriting from a role here.
 You're really inheriting from an anonymous class of the same name.  :-)

Hmm, Anonymous class with the name 'Array of Any' sounds like
an oxymoron.  Also consider:

role Foo {};
my Foo $x .= new;
my Foo $y .= new;
ref($x) eqv ref($y);# bool::true, surely?

If all the anonymous classes are actually the same class underneath, and
have the name that's identical to the role name, then where do their
anonymousness manifest?

Can we simply say Foo is a role can double as a class -- i.e. you
can choose to is it or does it?  Then it follows that Array of Any
is a class, and Array of Int is also a class, etc.

Thanks,
/Autrijus/


pgpBkk8lgJ4Qc.pgp
Description: PGP signature


Re: Generic classes.

2005-08-15 Thread Autrijus Tang
On Mon, Aug 15, 2005 at 08:19:38AM -0700, Larry Wall wrote:
 I think the distinction is still useful to document that there are
 still unbound types.  What we need to emphasize is that a role can be
 used as a class, at which point any unbound types are bound to Any,
 or whatever we're calling it these days.  I'd say Array is a role,
 not a class.  So these all might do different things:
 
 class LoudArray is Array { ... }
 role LoudArray does Array { ... }
 role LoudArray is Array { ... }

So the last line means a role can be used just like a class, and
_inherit_ its behaviour as well?

role Point { has $.x; has $.y; method move_right { $.x++ } };
role MyPoint is Point {
method move_right { ./SUPER::move_right(); $.y++; }
}

Thanks,
/Autrijus/


pgpXgDRhRriNM.pgp
Description: PGP signature


Generic classes.

2005-08-14 Thread Autrijus Tang
S06 made many explicit uses of generics as classes, which I find
difficult to reconcile with the only roles takes type parameter
ruling.  For example:

my Hash of Array of Recipe %book;
my Hash[returns=Array[returns=Recipe]] %book;

And later:

class LoudArray is Array { ... }

Clearly, here Hash and Array are used as instantiable, generic classes,
instead of mere roles.  Does this need to change, or can we lift the
ban on type-parameterized classes?

Thanks,
/Autrijus/


pgpr7zGjVCxbv.pgp
Description: PGP signature


Re: Typed type variables (my Foo ::x)

2005-08-11 Thread Autrijus Tang
On Thu, Aug 11, 2005 at 08:02:00PM +1000, Stuart Cook wrote:
 What's the current meaning of type annotations on type-variables?
 
 For example, if I say...
 
 my Foo ::x;
 
 ...which of these does it mean?
 
 a) ::x (=) ::Foo (i.e. any type assigned to x must be covariant wrt. Foo)
 b) ::x is an object of type Foo, where Foo.does(Class)
 c) Something else?

My current reading is a) -- but only if ::x stays implicitly
is constant.  So your assigned above should read bound.

 Also, can I do crazy stuff like this?
 
 my $a = ::Foo;
 my ::$a $obj;  # analogous to @$x, where $x is an arrayref

Note that $a at compile time is unbound, so that automatically fails.
Now had you written this:

my $a ::= ::Foo;
my ::$a $obj;

Then I can see it working.

Thanks,
/Autrijus/


pgp1SkCTrbh4L.pgp
Description: PGP signature


Re: Classes as special undefs

2005-08-11 Thread Autrijus Tang
On Thu, Aug 11, 2005 at 08:53:47PM +1000, Stuart Cook wrote:
 On 11/08/05, Brent 'Dax' Royal-Gordon [EMAIL PROTECTED] wrote:
  One that you missed was that this syntax:
  
 my Dog $spot .=new();
  
  Falls out of it quite naturally.
 
 Actually I tried to mention that indirectly, but I'm glad you
 explicitly mentioned it.

What about this?

my $spot = Dog;
defined($spot); # false!?
$spot .= new;   # instantiated?

Thanks,
/Autrijus/


pgpVmHxYvBWWM.pgp
Description: PGP signature


  1   2   3   >