r32009 -[S02] revert Nil to undefined singleton value for masak++ et al.++

2010-08-16 Thread pugs-commits
Author: lwall
Date: 2010-08-16 16:13:31 +0200 (Mon, 16 Aug 2010)
New Revision: 32009

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[S02] revert Nil to undefined singleton value for masak++ et al.++
(Note, despite being a kind of bottom, it is not a type as it was before.)


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-08-16 07:49:05 UTC (rev 32008)
+++ docs/Perl6/Spec/S02-bits.pod2010-08-16 14:13:31 UTC (rev 32009)
@@ -13,8 +13,8 @@
 
 Created: 10 Aug 2004
 
-Last Modified: 16 Jul 2010
-Version: 220
+Last Modified: 16 Aug 2010
+Version: 221
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -2153,22 +2153,27 @@
 you can think of Perl 5 references as a degenerate form of CCapture
 when you want to refer only to a single item.
 
-The empty CParcel is a value with a special name: CNil.  It is the
-named equivalent of the empty C() list.  The CNil value returns
-CMu if you iterate it or try to get a positional value from it, but
+There is a special CParcel value named CNil.  It means there is no
+value here.  It is the undefined equivalent of the empty C() list, except 
that the
+latter is defined and means there are 0 arguments here.  The CNil value 
returns
+itself if you iterate it or try to get a positional value from it, but
 interpolates as a null list into flat context, and an empty CSeq
 into slice context.  Since method calls are performed directly on
-any object, CNil.defined returns CTrue just as C().defined does.
+any object, CNil.defined returns CFalse while C().defined returns 
CTrue.
 
-Assigning or binding CNil to any scalar container causes the
+Assigning CNil to any scalar container causes the
 container to throw out any contents and restore itself to an
 uninitialized state (after which it will contain a type object
 appropriate to the declared type of the container, where CAny
-is the default type).
+is the default type).  Binding of CNil has a similar result, except that 
binding
+CNil to a parameter with a default causes that parameter to be set to its
+default value rather than an undefined value, as if the argument had not
+been supplied.
 
 Assigning or binding CNil to any composite container (such as an
 CArray or CHash) empties the container, resetting it back to an
-uninitialized state.  The container object itself remains defined.
+uninitialized state.  The container object itself the becomes undefined.
+(Asssignment of C() leaves it defined.)
 
 The Csink statement prefix will eagerly evaluate any block or
 statement, throw away the results, and instead return the CNil value.



r32010 -[S02] typo fix.

2010-08-16 Thread pugs-commits
Author: qiuhw
Date: 2010-08-16 16:21:14 +0200 (Mon, 16 Aug 2010)
New Revision: 32010

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[S02] typo fix.


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-08-16 14:13:31 UTC (rev 32009)
+++ docs/Perl6/Spec/S02-bits.pod2010-08-16 14:21:14 UTC (rev 32010)
@@ -2172,7 +2172,7 @@
 
 Assigning or binding CNil to any composite container (such as an
 CArray or CHash) empties the container, resetting it back to an
-uninitialized state.  The container object itself the becomes undefined.
+uninitialized state.  The container object itself then becomes undefined.
 (Asssignment of C() leaves it defined.)
 
 The Csink statement prefix will eagerly evaluate any block or



r32013 -[S02] spec which methods Nil responds to,

2010-08-16 Thread pugs-commits
Author: lwall
Date: 2010-08-16 19:49:53 +0200 (Mon, 16 Aug 2010)
New Revision: 32013

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[S02] spec which methods Nil responds to,
and that it propagates Nil on unrecognized methods


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-08-16 14:30:39 UTC (rev 32012)
+++ docs/Perl6/Spec/S02-bits.pod2010-08-16 17:49:53 UTC (rev 32013)
@@ -14,7 +14,7 @@
 Created: 10 Aug 2004
 
 Last Modified: 16 Aug 2010
-Version: 221
+Version: 222
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -2153,14 +2153,23 @@
 you can think of Perl 5 references as a degenerate form of CCapture
 when you want to refer only to a single item.
 
-There is a special CParcel value named CNil.  It means there is no
-value here.  It is the undefined equivalent of the empty C() list, except 
that the
-latter is defined and means there are 0 arguments here.  The CNil value 
returns
-itself if you iterate it or try to get a positional value from it, but
+There is a special CParcel value named CNil.  It means there
+is no value here.  It is the undefined equivalent of the empty
+C() list, except that the latter is defined and means there are
+0 arguments here.  The CNil value returns itself if you iterate
+it or try to get a positional value from it via subscripting, but
 interpolates as a null list into flat context, and an empty CSeq
-into slice context.  Since method calls are performed directly on
-any object, CNil.defined returns CFalse while C().defined returns 
CTrue.
+into slice context.  In either case, a warning is issued.
 
+Since method calls are performed directly on any object, CNil
+can respond to certain method calls.  CNil.defined returns
+CFalse (whereas C().defined returns CTrue).  CNil.so also
+returns CFalse.  CNil.ACCEPTS is always false.  CNil.perl and
+CNil.Str return CNil.  CNil.Stringy returns '' with a warning.
+CNil.Numeric returns 0 with a warning.  Any undefined method call
+on CNil returns CNil, so that CNil propagates down method
+call chains.
+
 Assigning CNil to any scalar container causes the
 container to throw out any contents and restore itself to an
 uninitialized state (after which it will contain a type object



r32014 -[S02,S03] allow Nil to smartmatch a Nil

2010-08-16 Thread pugs-commits
Author: lwall
Date: 2010-08-16 19:54:52 +0200 (Mon, 16 Aug 2010)
New Revision: 32014

Modified:
   docs/Perl6/Spec/S02-bits.pod
   docs/Perl6/Spec/S03-operators.pod
Log:
[S02,S03] allow Nil to smartmatch a Nil


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-08-16 17:49:53 UTC (rev 32013)
+++ docs/Perl6/Spec/S02-bits.pod2010-08-16 17:54:52 UTC (rev 32014)
@@ -2164,7 +2164,7 @@
 Since method calls are performed directly on any object, CNil
 can respond to certain method calls.  CNil.defined returns
 CFalse (whereas C().defined returns CTrue).  CNil.so also
-returns CFalse.  CNil.ACCEPTS is always false.  CNil.perl and
+returns CFalse.  CNil.ACCEPTS matches only a CNil value.  CNil.perl and
 CNil.Str return CNil.  CNil.Stringy returns '' with a warning.
 CNil.Numeric returns 0 with a warning.  Any undefined method call
 on CNil returns CNil, so that CNil propagates down method

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-08-16 17:49:53 UTC (rev 32013)
+++ docs/Perl6/Spec/S03-operators.pod   2010-08-16 17:54:52 UTC (rev 32014)
@@ -15,8 +15,8 @@
 
 Created: 8 Mar 2004
 
-Last Modified: 26 Jun 2010
-Version: 212
+Last Modified: 16 Aug 2010
+Version: 213
 
 =head1 Overview
 
@@ -3512,6 +3512,7 @@
 Any   Numeric   numeric equality+$_ == X
 Any   Stringy   string equality ~$_ eq X
 Any   Whatever  always matches  True
+Any   Nil   is nil  $_ === Nil
 
 Hash  Pair  test hash mapping   $_{X.key} ~~ X.value
 Any   Pair  test object attribute   ?.{X.key} === ?X.value (e.g. 
filetests)



r31975 -[spec] small markup fixes

2010-08-13 Thread pugs-commits
Author: moritz
Date: 2010-08-13 11:03:22 +0200 (Fri, 13 Aug 2010)
New Revision: 31975

Modified:
   docs/Perl6/Spec/S03-operators.pod
   docs/Perl6/Spec/S05-regex.pod
Log:
[spec] small markup fixes

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-08-12 21:12:32 UTC (rev 31974)
+++ docs/Perl6/Spec/S03-operators.pod   2010-08-13 09:03:22 UTC (rev 31975)
@@ -1916,7 +1916,7 @@
 
 $ab = $b / $a;
 $bc = $c / $b;
-
+
 If the two quotients are equal (and finite), then a geometric
 function of C{$_ * $bc} is deduced.
 

Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-08-12 21:12:32 UTC (rev 31974)
+++ docs/Perl6/Spec/S05-regex.pod   2010-08-13 09:03:22 UTC (rev 31975)
@@ -655,6 +655,8 @@
 
 The C:dba adverb is only allowed inside a regex.
 
+=back
+
 =head1 Changed metacharacters
 
 =over



r31976 -[S06] make MAIN short switches a bit saner

2010-08-13 Thread pugs-commits
Author: moritz
Date: 2010-08-13 11:32:37 +0200 (Fri, 13 Aug 2010)
New Revision: 31976

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] make MAIN short switches a bit saner

The variable name of a parameter is purely an implementation detail
of the subroutine, and shouldn't be a concern while parsing command line
arguments. Instead rely on already existing alias syntax for named parameters.

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-08-13 09:03:22 UTC (rev 31975)
+++ docs/Perl6/Spec/S06-routines.pod2010-08-13 09:32:37 UTC (rev 31976)
@@ -3279,11 +3279,12 @@
 there's no particular reason the sub has to be named CMAIN.
 
 To give both a long and a short switch name, you may use the pair
-notation.  The key will be considered the short switch name, while
-the variable name will be considered the long switch name.  So if
-the previous declaration had been:
+notation to install several names for the same parameter.
+If any of the names is a single character, it will be considered a
+short switch name, while all other parameters names are considered
+as long switch name.  So if the previous declaration had been:
 
-sub MAIN (:f($frompart), :t($topart), *...@rest)
+sub MAIN (:f(:$frompart), :t(:$topart), *...@rest)
 
 then you could invoke the program with either C-f or C--frompart
 to specify the first parameter.  Likewise you could use either C-t



r31964 -[S05] saner defaults for :c and :p; without a previous match, $/.to blows up

2010-08-12 Thread pugs-commits
Author: moritz
Date: 2010-08-12 10:02:42 +0200 (Thu, 12 Aug 2010)
New Revision: 31964

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] saner defaults for :c and :p; without a previous match, $/.to blows up

Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-08-12 06:47:06 UTC (rev 31963)
+++ docs/Perl6/Spec/S05-regex.pod   2010-08-12 08:02:42 UTC (rev 31964)
@@ -278,7 +278,7 @@
 =item *
 
 The C:c (or C:continue) modifier causes the pattern to continue
-scanning from the specified position (defaulting to C$/.to):
+scanning from the specified position (defaulting to C($/ ?? $/.to !! 0)):
 
  m:c($p)/ pattern / # start scanning at position $p
 
@@ -296,7 +296,7 @@
 
  m:pos($p)/ pattern /  # match at position $p
 
-If the argument is omitted, it defaults to C$/.to.  (Unlike in
+If the argument is omitted, it defaults to C($/ ?? $/.to !! 0).  (Unlike in
 Perl 5, the string itself has no clue where its last match ended.)
 All subrule matches are implicitly passed their starting position.
 Likewise, the pattern you supply to a Perl macro's Cis parsed



r31972 -[S05] specify what .keys, .values and .kv do on Match objects

2010-08-12 Thread pugs-commits
Author: moritz
Date: 2010-08-12 21:10:33 +0200 (Thu, 12 Aug 2010)
New Revision: 31972

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] specify what .keys, .values and .kv do on Match objects

Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-08-12 13:53:57 UTC (rev 31971)
+++ docs/Perl6/Spec/S05-regex.pod   2010-08-12 19:10:33 UTC (rev 31972)
@@ -2710,6 +2710,11 @@
 
 =item *
 
+The C.keys, C.values and C.kv methods act both on the positional and the
+named captures, so the keys generally involved both numbers and indentifiers.
+
+=item *
+
 In ordinary code, variables C$0, C$1, etc. are just aliases into
 C$/[0], C$/[1], etc.  Hence they will all be undefined if the
 last match failed (unless they were explicitly bound in a closure without



r31973 -[S05] attempt to clarify wording, and add an example

2010-08-12 Thread pugs-commits
Author: moritz
Date: 2010-08-12 21:23:14 +0200 (Thu, 12 Aug 2010)
New Revision: 31973

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] attempt to clarify wording, and add an example

Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-08-12 19:10:33 UTC (rev 31972)
+++ docs/Perl6/Spec/S05-regex.pod   2010-08-12 19:23:14 UTC (rev 31973)
@@ -2710,9 +2710,12 @@
 
 =item *
 
-The C.keys, C.values and C.kv methods act both on the positional and the
-named captures, so the keys generally involved both numbers and indentifiers.
+The C.keys, C.values and C.kv methods act both on the list and hash
+part, with the list part coming first.
 
+'abcd' ~~ /(.)(.)**2 alpha/;
+say ~$/.keys;   # 1 2 alpha
+
 =item *
 
 In ordinary code, variables C$0, C$1, etc. are just aliases into



r31937 -[S32/Str] fixed thinko in pack signature

2010-08-10 Thread pugs-commits
Author: masak
Date: 2010-08-10 11:47:45 +0200 (Tue, 10 Aug 2010)
New Revision: 31937

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] fixed thinko in pack signature

Spotted by moritz++

Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-08-09 22:37:35 UTC (rev 
31936)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-08-10 09:47:45 UTC (rev 
31937)
@@ -269,7 +269,7 @@
 
 =item pack
 
- our buf8 multi pack( *...@items where { @items »~~» Pair })
+ our buf8 multi pack( *...@items where { [] @items »~~» Pair })
  our buf8 multi pack( Str $template, *...@items )
 
 Cpack takes a list of pairs and formats the values according to



r31938 -[S32/Str] nicer where clause for pack

2010-08-10 Thread pugs-commits
Author: masak
Date: 2010-08-10 13:50:30 +0200 (Tue, 10 Aug 2010)
New Revision: 31938

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] nicer where clause for pack

Reads better and is more amenable to compiler optimization. Suggested by
TheDamian++.

Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-08-10 09:47:45 UTC (rev 
31937)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-08-10 11:50:30 UTC (rev 
31938)
@@ -269,7 +269,7 @@
 
 =item pack
 
- our buf8 multi pack( *...@items where { [] @items »~~» Pair })
+ our buf8 multi pack( *...@items where { all(@items) ~~ Pair } )
  our buf8 multi pack( Str $template, *...@items )
 
 Cpack takes a list of pairs and formats the values according to



r31923 -[S32/Str] cruft-removal for pack

2010-08-08 Thread pugs-commits
Author: masak
Date: 2010-08-08 09:21:59 +0200 (Sun, 08 Aug 2010)
New Revision: 31923

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] cruft-removal for pack

- Ditch the encoding bit for now. Users can encode to Str the usual way.
- Not sure a typed slurpy parameter is going to fly. Changing to a 'where'
  clause.
- Added TOP rule to grammar, anchoring at start and end of format string.

Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-08-08 06:06:34 UTC (rev 
31922)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-08-08 07:21:59 UTC (rev 
31923)
@@ -269,9 +269,7 @@
 
 =item pack
 
- our Str multi pack( Str::Encoding $encoding,  Pair *...@items )
- our Str multi pack( Str::Encoding $encoding,  Str $template, *...@items )
- our buf8 multi pack( Pair *...@items )
+ our buf8 multi pack( *...@items where { @items »~~» Pair })
  our buf8 multi pack( Str $template, *...@items )
 
 Cpack takes a list of pairs and formats the values according to
@@ -280,26 +278,17 @@
 the specifications in the template string. The result is a sequence
 of bytes.
 
-An optional C$encoding can be used to specify the character
-encoding to use in interpreting the result as a CStr, otherwise the return
-value will simply be a Cbuf containing the bytes generated
-by the template(s) and value(s). Note that no guarantee is made
-in terms of the final, internal representation of the string, only
-that the generated sequence of bytes will be interpreted as a
-string in the given encoding, and a string containing those
-graphemes will be returned. If the sequence of bytes represents
-an invalid string according to C$encoding, an exception is generated.
-
 Templates are strings of the form:
 
   grammar Str::PackTemplate {
-   regex template  { [ group | specifier count? ]* }
-   token group { \( template \) }
-   token specifier { [aazbbhhccssiillnnvvqqjjfdfdppuuw...@] \!? }
-   token count { \* |
- \[ [ \d+ | specifier ] \] |
- \d+ }
- }
+regex TOP   { ^ template $ }
+regex template  { [ group | specifier count? ]* }
+token group { \( template \) }
+token specifier { [aazbbhhccssiillnnvvqqjjfdfdppuuw...@] \!? }
+token count { \*
+| \[ [ \d+ | specifier ] \]
+| \d+ }
+  }
 
 In the pairwise mode, each key must contain a single C group  or
 C specifier , and the values must be either scalar arguments or



r31918 -[S05] be explicit about which attributes/modifiers are allowed where

2010-08-06 Thread pugs-commits
Author: moritz
Date: 2010-08-06 19:52:06 +0200 (Fri, 06 Aug 2010)
New Revision: 31918

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] be explicit about which attributes/modifiers are allowed where

Also removes rx:g// from existing examples.
Added myself boldly to AUTHORS list

Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-08-06 17:52:01 UTC (rev 31917)
+++ docs/Perl6/Spec/S05-regex.pod   2010-08-06 17:52:06 UTC (rev 31918)
@@ -11,13 +11,14 @@
 Allison Randal a...@shadowed.net
 Patrick Michaud pmich...@pobox.com
 Larry Wall la...@wall.org
+Moritz Lenz mor...@faui2k3.org
 
 =head1 VERSION
 
 Created: 24 Jun 2002
 
-Last Modified: 11 Jul 2010
-Version: 128
+Last Modified: 6 Aug 2010
+Version: 129
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them Iregex rather than regular
@@ -604,6 +605,56 @@
 
 =back
 
+=head2 Allowed modifiers
+
+Some modifiers are allowed in all possible places where modifiers can occur,
+but not all of them.
+
+In general, a modifier that affects the compilation of a regex (like C:i)
+must be known at compile time. A modifier that affects only the calling
+behaviour, and not the regex itself (eg. C:pos, C:overlap, C:x(4)) may
+only appear on constructs that involve a call (like Cm// and Cs///), and
+not on Crx//. Finally overlapping is disallowed on substitutions, while
+adverbs that affect modifications (eg. C:samecase) are only allowed on
+substitutions.
+
+These principle result in the following rules:
+
+=over
+
+=item *
+
+The C:ignorecase, C:ignoremark C:sigspace, C:ratchet and C:Perl5
+modifiers and their short forms are allowed everywhere: inside a regex,
+and on Cm//, Crx// and Cs// constructs. An implementation may require
+that their value is known at compile time, and give a compile-time error
+message if that is not the case.
+
+rx:i/ hello /   # OK
+rx:i(1) /hello/ # OK
+my $i = 1;
+rx:i($i) /hello/# may error out at compile time
+
+=item *
+
+The C:samecase, C:samespace and C:samemark modifiers (and their short
+forms) modifiers are only allowed on substitutions (Cs/// and Cs[] = ...).
+
+=item *
+
+The C:overlap and C:exhaustive modifiers (and their short forms) are only
+allowed on matches (ie Cm//), not on substitutions or regex quotes.
+
+=item * 
+
+The C:pos, C:continue, C:x and C:nth modifiers and their aliases are
+only allowed on constructs that involve immediate calls, eg. Cm// and Cs//
+(but not on Crx//).
+
+=item *
+
+The C:dba adverb is only allowed inside a regex.
+
 =head1 Changed metacharacters
 
 =over
@@ -1967,8 +2018,8 @@
 
 If either form needs modifiers, they go before the opening delimiter:
 
- $regex = regex :g:s:i { my name is (.*) };
- $regex = rx:g:s:i / my name is (.*) /;# same thing
+ $regex = regex :s:i { my name is (.*) };
+ $regex = rx:s:i / my name is (.*) /;# same thing
 
 Space is necessary after the final modifier if you use any
 bracketing character for the delimiter.  (Otherwise it would be taken as
@@ -1979,7 +2030,7 @@
 You may not use colons for the delimiter.  Space is allowed between
 modifiers:
 
- $regex = rx :g :s :i / my name is (.*) /;
+ $regex = rx :s :i / my name is (.*) /;
 
 =item *
 



r31919 -[S03] smart-match entry for Match on RHS

2010-08-06 Thread pugs-commits
Author: moritz
Date: 2010-08-06 19:52:10 +0200 (Fri, 06 Aug 2010)
New Revision: 31919

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] smart-match entry for Match on RHS

After some discussion with @Larry on YAPC::EU, we figured that's the best way
to solve the dilemma that C'string' ~~ m/regex/ immediately matches on the
right-hand side, thus ends up calling $/.ACCEPTS('string').

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-08-06 17:52:06 UTC (rev 31918)
+++ docs/Perl6/Spec/S03-operators.pod   2010-08-06 17:52:10 UTC (rev 31919)
@@ -3536,6 +3536,8 @@
 Array Regex array boolean grep.any.match(X)
 Any   Regex pattern match   .match(X)
 
+Any   Match identity$_
+
 Num   Range in numeric rangeX.min = $_ = X.max (mod ^'s)
 Str   Range in string range X.min le $_ le X.max (mod ^'s)
 Any   Range in generic range[!after] X.min,$_,X.max (etc.)



r31885 -[S06] fix an obvious typo

2010-08-01 Thread pugs-commits
Author: sorear
Date: 2010-08-01 11:18:45 +0200 (Sun, 01 Aug 2010)
New Revision: 31885

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] fix an obvious typo


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-08-01 07:09:36 UTC (rev 31884)
+++ docs/Perl6/Spec/S06-routines.pod2010-08-01 09:18:45 UTC (rev 31885)
@@ -64,7 +64,7 @@
 name within its scope, unless they have an explicit modifier.
 (This is particularly useful when adding to rule sets or when attempting
 to compose conflicting methods from roles.)  Abstractly, the Cproto
-is a wrapper around the dispatch to the Cmulti.s
+is a wrapper around the dispatch to the Cmultis.
 
 BOnly (keyword: Conly) routines do not share their short names
 with other routines.  This is the default modifier for all routines,



r31886 -[S03] remove Subst type, which appears nowhere else

2010-08-01 Thread pugs-commits
Author: moritz
Date: 2010-08-01 20:01:49 +0200 (Sun, 01 Aug 2010)
New Revision: 31886

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] remove Subst type, which appears nowhere else

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-08-01 09:18:45 UTC (rev 31885)
+++ docs/Perl6/Spec/S03-operators.pod   2010-08-01 18:01:49 UTC (rev 31886)
@@ -3586,7 +3586,6 @@
 named values created with
   Class, Enum, or Role,
   or generic type binding   Type
-Subst   Regex
 Char CatStr
 Int UInt etc.   Num
 Match   Capture



r31883 -[S26] Attempts at clarifying language

2010-07-31 Thread pugs-commits
Author: jani
Date: 2010-07-31 11:49:53 +0200 (Sat, 31 Jul 2010)
New Revision: 31883

Modified:
   docs/Perl6/Spec/S26-documentation.pod
Log:
[S26] Attempts at clarifying language

Modified: docs/Perl6/Spec/S26-documentation.pod
===
--- docs/Perl6/Spec/S26-documentation.pod   2010-07-31 08:15:21 UTC (rev 
31882)
+++ docs/Perl6/Spec/S26-documentation.pod   2010-07-31 09:49:53 UTC (rev 
31883)
@@ -13,7 +13,7 @@
 =table
 Maintainer: Damian Conway
 Date:   9 Apr 2005
-Last Modified:  30 Jul 2009
+Last Modified:  31 Jul 2010
 =end VERSION
 
 =head1
@@ -39,28 +39,31 @@
 of comments in Perl 6.
 
 Every directive starts either with an equals sign (C=) followed
-immediately by an identifier Nas specified in Synopsis 2, or with a
+immediately by an identifier Nas specified in Synopsis 2, or with
 C#= followed immediately by whitespace or an opening bracket.
 
 Directives that start with C= can be indented like the code they
 interleave, but their initial C= must still be the first non-whitespace
 character on their line. Directives that start with C#= can be placed
-anywhere that a Perl 6 comment can appear (though they are meaningful
-only in a subset of those places; see L#Declarator blocks).
+anywhere that a Perl 6 comment can appear, though they are meaningful
+only in a subset of those places; see L#Declarator blocks.
 
-If a directive is indented from the left margin, the column at which the
-first character of its opening delimiter appears is thereafter
-considered the first column of the entire block's contents. That is, an
-indented Pod block is considered to have a Ivirtual left margin,
-determined by the indentation of its opening delimiter. As with Perl 6
-heredocs, the virtual margin treats leading tabs as aligning to tabstops
-spaced every C($?TABSTOP // 8) characters.
+An indented Pod block is considered to have a Ivirtual left margin,
+determined by the indentation of its opening delimiter.
 
+In other words, if a directive is indented from the left margin, the
+column at which the first character of its opening delimiter appears is
+thereafter considered the first column of the entire block's contents.
+
+As with Perl 6 heredocs, the virtual margin treats leading tabs as
+aligning to tabstops spaced every C($?TABSTOP // 8) characters.
+
 =head2
 Pod blocks
 
 The content of a document is specified within one or more Dblocks|block.
 Every Pod block may be declared in any of four forms:
+
 LIdelimited style|#Delimited blocks, LIparagraph style|#Paragraph
 blocks, LIabbreviated style|#Abbreviated blocks, or LIdeclarator
 style|#Declarator blocks. The first three forms are all equivalent; the
@@ -70,8 +73,8 @@
 within a Pod block is treated as ambient material. Typically this
 would be the source code of the program that the Pod is documenting. Pod
 parsers still parse this text into the internal representation of the
-file (representing it as a CPod6::Block::Ambient block), but renderers
-will Iusually ignore such blocks (but see L#Aliases).
+file, representing it as a CPod6::Block::Ambient block. Renderers
+will Iusually ignore such blocks, but see L#Aliases.
 
 In Perl 5's POD format, once a POD directive is encountered, the parser
 considers everything that follows to be POD, until an explicit C=cut



r31869 -[S26] corrected minor typos and inconsistencies

2010-07-30 Thread pugs-commits
Author: masak
Date: 2010-07-30 18:15:01 +0200 (Fri, 30 Jul 2010)
New Revision: 31869

Modified:
   docs/Perl6/Spec/S26-documentation.pod
Log:
[S26] corrected minor typos and inconsistencies

Nothing that changes the meaning of the spec, really.

Modified: docs/Perl6/Spec/S26-documentation.pod
===
--- docs/Perl6/Spec/S26-documentation.pod   2010-07-30 16:11:56 UTC (rev 
31868)
+++ docs/Perl6/Spec/S26-documentation.pod   2010-07-30 16:15:01 UTC (rev 
31869)
@@ -13,7 +13,7 @@
 =table
 Maintainer: Damian Conway
 Date:   9 Apr 2005
-Last Modified:  16 Aug 2009
+Last Modified:  30 Jul 2009
 =end VERSION
 
 =head1
@@ -297,7 +297,7 @@
 }
 
 #= This subroutine does the real work
-sub so_raw_magic (
+sub do_raw_magic (
 Spell $s, #= Which spell to invoke
 *%options #= How to invoke it
 ) {...}
@@ -316,8 +316,8 @@
 sub fu ( #= This text stored in Cfu.WHY
 Any $bar,#= This text stored in C$bar.WHY
 Mode:$baz,   #= This text stored in C$baz.WHY
-Context :$the_context_in_which_we_foo?
- #= This stored in C$the_context_in_which_we_foo.WHY
+Context :$the_context_in_which_we_fu?
+ #= This stored in C$the_context_in_which_we_fu.WHY
 ) { ... }
 
 sub fu2 (Any $bar)
@@ -395,7 +395,7 @@
.kast(Spell $s)  : Initiate a specified spell abnormally
 
   Subroutines:
-so_raw_magic(   : This subroutine does the real work
+do_raw_magic(   : This subroutine does the real work
 Spell $s, : Which spell to invoke
 *%options : How to invoke it
 )
@@ -471,7 +471,7 @@
 blocks all have implicit nesting.
 
 Nesting of blocks is usually rendered by adding extra indentation to the
-block contents, but may also be indicated in others ways:
+block contents, but may also be indicated in other ways:
 by boxing the contents, by changing the font or size of the nested text,
 or even by folding the text (so long as a visible placeholder is provided).
 



r31878 -[S02, S32] kill off .notdef

2010-07-30 Thread pugs-commits
Author: masak
Date: 2010-07-30 21:46:36 +0200 (Fri, 30 Jul 2010)
New Revision: 31878

Modified:
   docs/Perl6/Spec/S02-bits.pod
   docs/Perl6/Spec/S32-setting-library/Basics.pod
Log:
[S02, S32] kill off .notdef

Not cute with methods that do negatively defined things. And !*.defined
covers the semantic hole that *.notdef was meant to fill, so no need to
keep it.

Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-30 18:41:06 UTC (rev 31877)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-30 19:46:36 UTC (rev 31878)
@@ -1045,7 +1045,7 @@
 
 @primes = grep *.prime, 2..*;
 subset Duck where *.^can('quack');
-when *.notdef {...}
+when !*.defined {...}
 
 These returned closures are of type CWhateverCode:($) or 
CWhateverCode:($,$)
 rather than type CWhatever, so constructs that do want to handle C*

Modified: docs/Perl6/Spec/S32-setting-library/Basics.pod
===
--- docs/Perl6/Spec/S32-setting-library/Basics.pod  2010-07-30 18:41:06 UTC 
(rev 31877)
+++ docs/Perl6/Spec/S32-setting-library/Basics.pod  2010-07-30 19:46:36 UTC 
(rev 31878)
@@ -38,9 +38,6 @@
  our Bool multi method defined ($self:) is export {...}
  our Bool multi method defined ($self: ::role ) is export {...}
 
- our Bool multi method notdef ($self:) is export {...}
- our Bool multi method notdef ($self: ::role ) is export {...}
-
  our multi method undefine( $self: ) is export {...}
 
  method not() {...}



r31835 -[S32/Temporal] Specified how DateTime.new(Int) should interpret ambiguous input.

2010-07-26 Thread pugs-commits
Author: Kodi
Date: 2010-07-26 15:57:17 +0200 (Mon, 26 Jul 2010)
New Revision: 31835

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Specified how DateTime.new(Int) should interpret ambiguous input.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-26 12:05:05 UTC 
(rev 31834)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-26 13:57:17 UTC 
(rev 31835)
@@ -15,8 +15,8 @@
 
 Created: 19 Mar 2009
 
-Last Modified: 24 Jul 2010
-Version: 18
+Last Modified: 26 Jul 2010
+Version: 19
 
 The document is a draft.
 
@@ -75,7 +75,10 @@
 my $now = DateTime.new(time);
 
 These two statements are equivalent except that Ctime doesn't know about
-leap seconds or fractions of seconds.
+leap seconds or fractions of seconds. Ambiguous POSIX times (such as
+915148800, which could refer to 1998-12-31T23:59:60Z or
+1999-01-01T00:00:00Z) are interpreted as non-leap seconds (so in this case,
+the result would be 1999-01-01T00:00:00Z).
 
 Or you can use named arguments:
 



r31820 -[S32/Temporal] Fixed an inconsistency and uniquified a section title to avoid confusing smartlinks.pl.

2010-07-24 Thread pugs-commits
Author: Kodi
Date: 2010-07-25 01:41:01 +0200 (Sun, 25 Jul 2010)
New Revision: 31820

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Fixed an inconsistency and uniquified a section title to avoid 
confusing smartlinks.pl.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-24 23:21:46 UTC 
(rev 31819)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-24 23:41:01 UTC 
(rev 31820)
@@ -15,8 +15,8 @@
 
 Created: 19 Mar 2009
 
-Last Modified: 21 Jul 2010
-Version: 17
+Last Modified: 24 Jul 2010
+Version: 18
 
 The document is a draft.
 
@@ -199,14 +199,14 @@
 The method Cwhole-second returns the second truncated to an integer.
 
 The CDate method returns a CDate object, and is the same as
-CDate.new(|$dt.ymd).
+CDate.new($dt.year, $dt.month, $dt.day).
 
 The method Coffset returns the object's current offset from UTC: if
 C$dt.timezone does CCallable, C$dt.offset is equivalent to
 C$dt.timezone($dt, True); otherwise, C$dt.offset returns
 C$dt.timezone as is.
 
-=head1 Date
+=head1 CDate
 
 CDate objects represent a day without a time component. Like CDateTime
 objects, they are immutable. They allow easier manipulation by assuming
@@ -227,7 +227,7 @@
 The constructors die with a helpful error message if month or day are out of
 range.
 
-=head2 Accessors
+=head2 Instance methods
 
 CDate objects support all of the following accessors, which work just
 like their CDateTime equivalents:



r31791 -[S02] Move CALLER:: to the reserved anywhere in a name section, because CALLER::CALLER:: is explicitly described.

2010-07-23 Thread pugs-commits
Author: sorear
Date: 2010-07-23 11:45:15 +0200 (Fri, 23 Jul 2010)
New Revision: 31791

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[S02] Move CALLER:: to the reserved anywhere in a name section, because 
CALLER::CALLER:: is explicitly described.


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-22 21:54:53 UTC (rev 31790)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-23 09:45:15 UTC (rev 31791)
@@ -2457,12 +2457,12 @@
 GLOBAL  # Interpreter-wide package symbols, really UNIT::GLOBAL
 PROCESS # Process-related globals (superglobals)
 COMPILING   # Lexical symbols in the scope being compiled
-CALLER  # Contextual symbols in the immediate caller's lexical scope
 DYNAMIC # Contextual symbols in my or any caller's lexical scope
 
 The following relative names are also reserved but may be used
 anywhere in a name:
 
+CALLER  # Contextual symbols in the immediate caller's lexical scope
 OUTER   # Symbols in the next outer lexical scope
 UNIT# Symbols in the outermost lexical scope of compilation unit
 SETTING # Lexical symbols in the unit's DSL (usually CORE)



r31789 -[S32] DateTime immutable, leap seconds validation

2010-07-22 Thread pugs-commits
Author: masak
Date: 2010-07-22 23:54:10 +0200 (Thu, 22 Jul 2010)
New Revision: 31789

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32] DateTime immutable, leap seconds validation

The rest of this message is from Kodi++, who prepared the combined
spec/Rakudo patch:

There are two major changes here: DateTimes are now immutable and
DateTime constructors now validate leap seconds.

tai-utc should provide a hash, not a subroutine, but this doesn't
work when Rakudo is compiled.

It shouldn't be too hard to write a Perl 5 script, to be run as
part of Rakudo's build process, that automatically updates the
leap-second table in tai-utc.pm.

I haven't run DateTime-strftime.t because ++supernovus is moving
strftime out of Rakudo, and hence DateTime-strftime.t out of
pugs.


Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-22 19:08:46 UTC 
(rev 31788)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-22 21:54:10 UTC 
(rev 31789)
@@ -15,8 +15,8 @@
 
 Created: 19 Mar 2009
 
-Last Modified: 20 Jul 2010
-Version: 16
+Last Modified: 21 Jul 2010
+Version: 17
 
 The document is a draft.
 
@@ -66,10 +66,10 @@
 
 =head1 CDateTime
 
-A CDateTime object describes the time as it would appear on someone's
-calendar and someone's clock. You can create a CDateTime object from an
-CInstant or from an CInt; in the latter case, the argument is
-interpreted as POSIX time.
+A CDateTime object, which is immutable, describes a moment in time as it
+would appear on someone's calendar and someone's clock. You can create a
+CDateTime object from an CInstant or from an CInt; in the latter
+case, the argument is interpreted as POSIX time.
 
 my $now = DateTime.new(now);
 my $now = DateTime.new(time);
@@ -94,7 +94,7 @@
 Another multi exists with CDate :date instead of C:year, C:month and
 C:day (and the same defaults as listed above).
 
-All four of the aforementioned forms of Cnew accept two additional named
+All of the aforementioned forms of Cnew accept two additional named
 arguments. C:formatter is a callable object that takes a CDateTime and
 returns a string. The default formatter creates an ISO 8601 timestamp (see
 below). C:timezone is a callable object that takes a CDateTime to
@@ -123,17 +123,45 @@
 
 With all the above constructors, if you attempt to pass in values that
 are outside of the ranges specified in the list above, you'll get an
-exception.  An exception will also be thrown if the particular day
-doesn't exist in that month (for example April 31st) or in that non-leap
-year (for example February 29th 2006). By default, no such checking is
-done against leap seconds. This class also explicitly does not check
-against ambiguous or invalid local times caused by Daylight Saving Time.
+exception. An exception will also be thrown if the given day (like 31 April
+2000 or 29 February 2006) or second (like 23:59:60 on 1 January 2000)
+doesn't exist. The same checks are run when you produce an object with
+Cclone:
 
+my $dt = DateTime.new(:year(1999), :month(1), :day(29));
+say $dt.clone(:year(2000), :month(2)); # 2000-02-29T00:00:00Z
+say $dt.clone(:year(1999), :month(2)); # WRONG; 1999 was a common year
+
+However, this class explicitly does not check against ambiguous or invalid
+local times caused by Daylight Saving Time.
+
+To convert an object from one time zone to another, use the Cin-timezone
+method:
+
+my $dt = DateTime.new('2005-02-01T15:00:00+0900');
+say $dt.hour;   # 15
+$dt = $dt.in-timezone(6 * 60 * 60); # 6 hours ahead of UTC
+say $dt.hour;   # 12
+
+The Cutc method is shorthand for Cin-timezone(0).
+
+The Ctruncated-to method allows you to clear a number of time values
+below a given resolution:
+
+my $dt = DateTime.new('2005-02-01T15:20:35Z');
+say $dt.truncated-to(:hour); # 2005-02-01T15:00:00Z
+
+An argument of C:week yields an object with the date of the last Monday
+(or the same date, if it already is a Monday) and with hours, minutes, and
+seconds all set to zero:
+
+say $dt.truncated-to(:week); # 2005-01-31T00:00:00Z
+
 There's one additional constructor: Cnow. It works just like
 CDateTime.new(now) except that there is no positional parameter and the
 C:timezone argument defaults to the system's local time zone.
 
-=head2 Get methods
+=head2 Accessors
 
 There are methods Cyear, Cmonth, Cday, Chour, Cminute, Csecond,
 Ctimezone, and Cformatter, giving you the corresponding values of the
@@ -178,52 +206,11 @@
 C$dt.timezone($dt, True); otherwise, C$dt.offset returns
 C$dt.timezone as is.
 
-=head2 Set methods
-
-To set the the day of a CDateTime object to something, just assign to
-its public accessor:
-
-$dt.day = 15;
-
-The same methods exists for all the values you can set in the
-constructor: Cyear, Cmonth, Cday, 

r31773 -Fix minor typo

2010-07-20 Thread pugs-commits
Author: tene
Date: 2010-07-20 20:35:35 +0200 (Tue, 20 Jul 2010)
New Revision: 31773

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
Fix minor typo

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-07-20 03:45:37 UTC (rev 31772)
+++ docs/Perl6/Spec/S03-operators.pod   2010-07-20 18:35:35 UTC (rev 31773)
@@ -1741,7 +1741,7 @@
 @a minmax @b
 
 Returns a CRange from the minimum element of C@a and C@b to the maximum
-element. CRange elements in the input9 are treated as if their
+element. CRange elements in the input are treated as if their
 minimum and maximum values were passed individually, except that if the
 corresponding Cexcludes flag is set in Range, the excludes flag is also set
 in the returned CRange.



r31776 -[S32/Temporal] Make DateTime immutable.

2010-07-20 Thread pugs-commits
Author: dolmen
Date: 2010-07-20 23:51:26 +0200 (Tue, 20 Jul 2010)
New Revision: 31776

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Make DateTime immutable.


Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-20 21:11:32 UTC 
(rev 31775)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-20 21:51:26 UTC 
(rev 31776)
@@ -15,8 +15,8 @@
 
 Created: 19 Mar 2009
 
-Last Modified: 15 Jul 2010
-Version: 14
+Last Modified: 20 Jul 2010
+Version: 15
 
 The document is a draft.
 
@@ -67,7 +67,11 @@
 =head1 CDateTime
 
 A CDateTime object describes the time as it would appear on someone's
-calendar and someone's clock. You can create a CDateTime object from an
+calendar and someone's clock.
+
+CDateTime objects are immutables.
+
+You can create a CDateTime object from an
 CInstant or from an CInt; in the latter case, the argument is
 interpreted as POSIX time.
 
@@ -94,7 +98,11 @@
 Another multi exists with CDate :date instead of C:year, C:month and
 C:day (and the same defaults as listed above).
 
-All four of the aforementioned forms of Cnew accept two additional named
+A CDateTime can also be created by modifying an existing object:
+
+my $moonlanding_anniv = DateTime.new($moonlanding, :year(2010));
+
+All five of the aforementioned forms of Cnew accept two additional named
 arguments. C:formatter is a callable object that takes a CDateTime and
 returns a string. The default formatter creates an ISO 8601 timestamp (see
 below). C:timezone is a callable object that takes a CDateTime to
@@ -178,38 +186,11 @@
 C$dt.timezone($dt, True); otherwise, C$dt.offset returns
 C$dt.timezone as is.
 
-=head2 Set methods
+The Ctruncate method returns a new object where a number of time values
+have been cleared below a given resolution:
 
-To set the the day of a CDateTime object to something, just assign to
-its public accessor:
+$dt2 = $dt.truncate( :tohour ); # clears minutes and seconds
 
-$dt.day = 15;
-
-The same methods exists for all the values you can set in the
-constructor: Cyear, Cmonth, Cday, Chour, Cminute, Csecond,
-Ctimezone and Cformatter.  Also, there's a Cset method, which
-accepts all of these as named arguments, allowing several values to be
-set at once:
-
-$dt.set( :year(2014), :month(12), :day(25) );
-
-Just as with the Cnew method, validation is performed on the resulting
-values, and an exception is thrown if the result isn't a sensible date
-and time.
-
-If you use the Ctimezone public accessor to adjust the time zone, the
-local time zone is adjusted accordingly:
-
-my $dt = DateTime.new('2005-02-01T15:00:00+0900');
-say $dt.hour;# 15
-$dt.timezone = 6 * 60 * 60;  # 6 hours ahead of UTC
-say $dt.hour;# 12
-
-The Ctruncate method allows you to clear a number of time values
-below a given resolution:
-
-$dt.truncate( :tohour ); # clears minutes and seconds
-
 The time units are cleared in the sense that they are set to their
 inherent defaults: 1 for months and days, 0 for the time components.
 
@@ -217,9 +198,6 @@
 Monday of the week in which it occurs, and the time components are all
 set to 0.
 
-For the convenience of method chaining, Cset and Ctruncate return the
-calling object.
-
 =head1 Date
 
 CDate objects are immutable and represent a day without a time component.
@@ -268,6 +246,8 @@
 $d + 3  # Date.new('2010-12-27')
 3  + $d # Date.new('2010-12-27')
 
+As temporal objects are immutable, += -= ... do not work.
+
 =head1 Additions
 
 Please post errors and feedback to Cperl6-language. If you are making
@@ -290,3 +270,4 @@
 Daniel Ruoso dan...@ruoso.com
 Dave Rolsky auta...@urth.org
 Matthew (lue) rnd...@gmail.com
+Olivier Mengué dol...@cpan.org



r31777 -[S32/Temporal] Reverted DateTime back to being mutable. I think we ought to make a big change like this only after reaching some kind of consensus to do so, not least because I just implemente

2010-07-20 Thread pugs-commits
Author: Kodi
Date: 2010-07-21 02:12:24 +0200 (Wed, 21 Jul 2010)
New Revision: 31777

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Reverted DateTime back to being mutable. I think we ought to 
make a big change like this only after reaching some kind of consensus to do 
so, not least because I just implemented a lot of mutating methods!

Note that += and friends need only the *container* on the LHS to be mutable, 
not the value?\226?\128?\148'$x += 1' should be allowed whether $x holds an 
Int, a Date, or a DateTime.


Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-20 21:51:26 UTC 
(rev 31776)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-21 00:12:24 UTC 
(rev 31777)
@@ -16,7 +16,7 @@
 Created: 19 Mar 2009
 
 Last Modified: 20 Jul 2010
-Version: 15
+Version: 16
 
 The document is a draft.
 
@@ -67,11 +67,7 @@
 =head1 CDateTime
 
 A CDateTime object describes the time as it would appear on someone's
-calendar and someone's clock.
-
-CDateTime objects are immutables.
-
-You can create a CDateTime object from an
+calendar and someone's clock. You can create a CDateTime object from an
 CInstant or from an CInt; in the latter case, the argument is
 interpreted as POSIX time.
 
@@ -98,11 +94,7 @@
 Another multi exists with CDate :date instead of C:year, C:month and
 C:day (and the same defaults as listed above).
 
-A CDateTime can also be created by modifying an existing object:
-
-my $moonlanding_anniv = DateTime.new($moonlanding, :year(2010));
-
-All five of the aforementioned forms of Cnew accept two additional named
+All four of the aforementioned forms of Cnew accept two additional named
 arguments. C:formatter is a callable object that takes a CDateTime and
 returns a string. The default formatter creates an ISO 8601 timestamp (see
 below). C:timezone is a callable object that takes a CDateTime to
@@ -186,11 +178,38 @@
 C$dt.timezone($dt, True); otherwise, C$dt.offset returns
 C$dt.timezone as is.
 
-The Ctruncate method returns a new object where a number of time values
-have been cleared below a given resolution:
+=head2 Set methods
 
-$dt2 = $dt.truncate( :tohour ); # clears minutes and seconds
+To set the the day of a CDateTime object to something, just assign to
+its public accessor:
 
+$dt.day = 15;
+
+The same methods exists for all the values you can set in the
+constructor: Cyear, Cmonth, Cday, Chour, Cminute, Csecond,
+Ctimezone and Cformatter.  Also, there's a Cset method, which
+accepts all of these as named arguments, allowing several values to be
+set at once:
+
+$dt.set( :year(2014), :month(12), :day(25) );
+
+Just as with the Cnew method, validation is performed on the resulting
+values, and an exception is thrown if the result isn't a sensible date
+and time.
+
+If you use the Ctimezone public accessor to adjust the time zone, the
+local time zone is adjusted accordingly:
+
+my $dt = DateTime.new('2005-02-01T15:00:00+0900');
+say $dt.hour;# 15
+$dt.timezone = 6 * 60 * 60;  # 6 hours ahead of UTC
+say $dt.hour;# 12
+
+The Ctruncate method allows you to clear a number of time values
+below a given resolution:
+
+$dt.truncate( :tohour ); # clears minutes and seconds
+
 The time units are cleared in the sense that they are set to their
 inherent defaults: 1 for months and days, 0 for the time components.
 
@@ -198,6 +217,9 @@
 Monday of the week in which it occurs, and the time components are all
 set to 0.
 
+For the convenience of method chaining, Cset and Ctruncate return the
+calling object.
+
 =head1 Date
 
 CDate objects are immutable and represent a day without a time component.
@@ -246,8 +268,6 @@
 $d + 3  # Date.new('2010-12-27')
 3  + $d # Date.new('2010-12-27')
 
-As temporal objects are immutable, += -= ... do not work.
-
 =head1 Additions
 
 Please post errors and feedback to Cperl6-language. If you are making



r31754 -[S29] remove fossile noted by tylercurtis++

2010-07-18 Thread pugs-commits
Author: moritz
Date: 2010-07-18 17:13:40 +0200 (Sun, 18 Jul 2010)
New Revision: 31754

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29] remove fossile noted by tylercurtis++

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2010-07-18 14:40:10 UTC (rev 31753)
+++ docs/Perl6/Spec/S29-functions.pod   2010-07-18 15:13:40 UTC (rev 31754)
@@ -748,11 +748,8 @@
 
 =head3 Numeric
 
-The following functions can now be found in or replaced by something in the 
Numeric
-modules.
+See LS32-setting-library/Numeric.
 
-abs, atan2, cos, exp, log, rand, sqrt, sin
-
 =head3 IO
 
 The following functions can now be found in or replaced by something in the IO



r31755 -[S05] specifiy that .parse can invoke other subrules than TOP by name

2010-07-18 Thread pugs-commits
Author: moritz
Date: 2010-07-18 22:40:18 +0200 (Sun, 18 Jul 2010)
New Revision: 31755

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] specifiy that .parse can invoke other subrules than TOP by name

Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-07-18 15:13:40 UTC (rev 31754)
+++ docs/Perl6/Spec/S05-regex.pod   2010-07-18 20:40:18 UTC (rev 31755)
@@ -3943,7 +3943,10 @@
 All grammar objects are derived from CCursor, so every grammar object's
 value embodies the current state of the current match.  This new grammar
 object is then passed as the invocant to the CTOP method (regex, token,
-or rule) of CMyGrammar.  Grammar objects are considered immutable, so
+or rule) of CMyGrammar. The default rule name to call can be overridden with
+the C:rule named argument of the Cparse method.
+
+Grammar objects are considered immutable, so
 every match returns a different match state, and multiple match states may
 exist simultaneously.  Each such match state is considered a hypothesis on
 how the pattern will eventually match.  A backtrackable choice in pattern



r31727 -[spec] Add Real.rand to spec, as it was already in the spectests and Rakudo. Change term:rand description to refer to it.

2010-07-16 Thread pugs-commits
Author: colomon
Date: 2010-07-16 15:15:21 +0200 (Fri, 16 Jul 2010)
New Revision: 31727

Modified:
   docs/Perl6/Spec/S32-setting-library/Numeric.pod
Log:
[spec] Add Real.rand to spec, as it was already in the spectests and Rakudo.  
Change term:rand description to refer to it.

Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod
===
--- docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-07-16 13:07:17 UTC 
(rev 31726)
+++ docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-07-16 13:15:21 UTC 
(rev 31727)
@@ -19,8 +19,8 @@
 
 Created: 19 Mar 2009 extracted from S29-functions.pod
 
-Last Modified: 11 June 2010
-Version: 9
+Last Modified: 16 July 2010
+Version: 10
 
 The document is a draft.
 
@@ -148,8 +148,8 @@
 
 Pseudo random number in range C 0 ..^ 1 .  That is, C0 is
 theoretically possible, while C1 is not.  Note that there is no
-unary Crand function in Perl 6, so just multiply Crand by your
-desired multiplier.  For picking a random integer you probably want
+unary Crand function in Perl 6, but there is a Crand method.  
+For picking a random integer you probably want
 to use something like C(1..6).pick instead.
 
 =item sqrt
@@ -272,6 +272,14 @@
 you Imust call Csrand() yourself if you wish to specify a deterministic 
seed
 (or if you wish to be differently nondeterministic).
 
+=item rand
+
+ our Num multi method rand (Real $x:) is export
+
+Pseudo random number in range C 0 ..^ $x .  That is, C0 is
+theoretically possible, while C$x is not.  For picking a random integer
+you probably want to use something like C(1..6).pick instead.
+
 =item cis
 
 our Complex multi method cis (Real $angle:) is export



r31735 -[spec] Say a bit about Numeric operators and Bridge.

2010-07-16 Thread pugs-commits
Author: colomon
Date: 2010-07-16 20:39:33 +0200 (Fri, 16 Jul 2010)
New Revision: 31735

Modified:
   docs/Perl6/Spec/S32-setting-library/Numeric.pod
Log:
[spec] Say a bit about Numeric operators and Bridge.

Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod
===
--- docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-07-16 18:19:27 UTC 
(rev 31734)
+++ docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-07-16 18:39:33 UTC 
(rev 31735)
@@ -56,10 +56,16 @@
 
 CNumeric is a role for everything that's a scalar number. So CNum, CInt,
 CRat, CComplex and other numeric types do that role. However it is an
-abstract interface, so C$number.WHAT will never return CNumeric. Users who
-provide their own scalar numeric types are encouraged to implement the
-CNumeric role.
+abstract interface, so C$number.WHAT will never return CNumeric. 
 
+Users who provide their own scalar numeric types are encouraged to implement 
the
+CNumeric role.  It is intended that such types such support the basic 
arithmetic
+operators to the extent possible, as well as C==.  In addition, it is hoped 
that
+comparison operators will at least return consistent results, even if there is 
no
+sensible mathemtical ordering of your type.  That allows functions like sort 
to 
+not choke and die if they are handed a value of your type.  (See also the 
CReal
+role for scalar numeric types that represent real numbers.)
+
 The following are all defined in the CNumeric role:
 
 CNumeric provides some constants in addition to the basic
@@ -201,6 +207,15 @@
 a real scalar number (i.e. neither CComplex nor vector-like). For example
 CNum, CInt, CBool and CRat implement the CReal role.
 
+Users who provide their own scalar real numeric types are encouraged to 
implement the
+CReal role.  Because all CReal types are well-ordered, it is desirable 
that any two
+CReal types be mutally compatiable, even if they are not aware of each 
other.  The
+current proposal requires you to define a CBridge method in your CReal 
type, which
+converts your type into a neutral CReal type by restating it in terms of the 
fundamental
+Perl 6 types and calling CBridge on them.  This then makes the default 
CReal methods
+and operators all work with your CReal type.  While the name of this method 
may changed,
+it is hoped that something like this will remain in the spec.
+
 =over
 
 =item Complex



r31736 -[Numeric] fix typo and a technicality pointed out by Minimiscience++

2010-07-16 Thread pugs-commits
Author: lwall
Date: 2010-07-17 00:10:05 +0200 (Sat, 17 Jul 2010)
New Revision: 31736

Modified:
   docs/Perl6/Spec/S32-setting-library/Numeric.pod
Log:
[Numeric] fix typo and a technicality pointed out by Minimiscience++


Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod
===
--- docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-07-16 18:39:33 UTC 
(rev 31735)
+++ docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-07-16 22:10:05 UTC 
(rev 31736)
@@ -208,8 +208,9 @@
 CNum, CInt, CBool and CRat implement the CReal role.
 
 Users who provide their own scalar real numeric types are encouraged to 
implement the
-CReal role.  Because all CReal types are well-ordered, it is desirable 
that any two
-CReal types be mutally compatiable, even if they are not aware of each 
other.  The
+CReal role.  Because real numbers are strictly-totally-ordered and
+CReal types try to emulate that property, it is desirable that any two
+CReal types be mutally compatible, even if they are not aware of each other. 
 The
 current proposal requires you to define a CBridge method in your CReal 
type, which
 converts your type into a neutral CReal type by restating it in terms of the 
fundamental
 Perl 6 types and calling CBridge on them.  This then makes the default 
CReal methods



r31737 -[S02,S06] change YOU_ARE_HERE to {YOU_ARE_HERE} to better represent the UNIT block

2010-07-16 Thread pugs-commits
Author: lwall
Date: 2010-07-17 00:41:33 +0200 (Sat, 17 Jul 2010)
New Revision: 31737

Modified:
   docs/Perl6/Spec/S02-bits.pod
   docs/Perl6/Spec/S06-routines.pod
Log:
[S02,S06] change YOU_ARE_HERE to {YOU_ARE_HERE} to better represent the UNIT 
block


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-16 22:10:05 UTC (rev 31736)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-16 22:41:33 UTC (rev 31737)
@@ -13,8 +13,8 @@
 
 Created: 10 Aug 2004
 
-Last Modified: 11 Jul 2010
-Version: 219
+Last Modified: 16 Jul 2010
+Version: 220
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -2492,8 +2492,25 @@
 a CMAIN routine as documented in S06.  In this case the ordinary
 execution of the user's code is suppressed; instead, execution
 of the user's code is entirely delegated to the setting's CMAIN routine,
-which calls back to the user's lexically embedded code with CYOU_ARE_HERE.
+which calls back to the user's lexically embedded code with C{YOU_ARE_HERE}.
 
+The C{YOU_ARE_HERE} functions within the setting as a proxy for
+the user's CUNIT block, so C-n and C-p may be implemented in
+a setting with:
+
+for $*ARGFILES.lines {YOU_ARE_HERE} # -n
+map *.say, do for $*ARGFILES.lines {YOU_ARE_HERE}   # -p
+
+or
+
+map {YOU_ARE_HERE}, $*ARGFILES.lines;   # -n
+map *.say, map {YOU_ARE_HERE}, $*ARGFILES.lines;# -p
+
+and the user may use loop control phasers as if they were directly in
+the loop block.  Any COUTER in the user's code refers to the block
+outside of C{YOU_ARE_HERE}.  If used as a standalone statement,
+C{YOU_ARE_HERE} runs as if it were a bare block.
+
 Note that, since the CUNIT of an eval is the eval string itself,
 the CSETTING of an eval is the language in effect at the point
 of the eval, not the language in effect at the top of the file.

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-16 22:10:05 UTC (rev 31736)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-16 22:41:33 UTC (rev 31737)
@@ -16,8 +16,8 @@
 
 Created: 21 Mar 2003
 
-Last Modified: 12 Jul 2010
-Version: 141
+Last Modified: 16 Jul 2010
+Version: 142
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -3300,26 +3300,26 @@
 of the current compilation unit.  (The C-n and C-p command-line
 switches are implemented this way.)  In this case the user's mainline
 code is not automatically executed; instead, execution is controlled
-by the setting's CMAIN routine.  That routine calls CYOU_ARE_HERE
+by the setting's CMAIN routine.  That routine calls C{YOU_ARE_HERE}
 at the point where the user's code is to be lexically inserted (in
-the abstract).  A setting may also call CYOU_ARE_HERE outside of
+the abstract).  A setting may also call C{YOU_ARE_HERE} outside of
 a CMAIN routine, in which case it functions as a normal setting,
-and the CYOU_ARE_HERE merely indicates where the user's code
+and the C{YOU_ARE_HERE} merely indicates where the user's code
 goes logically.  (Or from the compiler's point of view, which the
 lexical scope to dump a snapshot of for later use by the compiler
 as the setting for a different compilation unit.)  In this case the
 execution of the user code proceeds as normal.  In fact, the CCORE
-setting ends with a CYOU_ARE_HERE to dump the CCORE lexical
+setting ends with a C{YOU_ARE_HERE} to dump the CCORE lexical
 scope as the standard setting.  In this sense, CCORE functions as
 an ordinary prelude.
 
 If a CMAIN routine is declared both in the setting and in the
 user's code, the setting's CMAIN functions as the actual mainline
 entry point.  The user's CMAIN functions in an embedded fashion;
-the setting's invocation of CYOU_ARE_HERE functions as the main
+the setting's invocation of C{YOU_ARE_HERE} functions as the main
 invocation from the point of view of the user's code, and the
 user's CMAIN routine will be invoked at the end of each call to
-CYOU_ARE_HERE.
+C{YOU_ARE_HERE}.
 
 =head2 Implementation note on autothreading of only subs
 



r31696 -[S32/Temporal] Permit day-of-month on Dates.

2010-07-15 Thread pugs-commits
Author: Kodi
Date: 2010-07-15 14:18:15 +0200 (Thu, 15 Jul 2010)
New Revision: 31696

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Permit day-of-month on Dates.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-15 12:12:31 UTC 
(rev 31695)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-15 12:18:15 UTC 
(rev 31696)
@@ -15,8 +15,8 @@
 
 Created: 19 Mar 2009
 
-Last Modified: 14 Jul 2010
-Version: 13
+Last Modified: 15 Jul 2010
+Version: 14
 
 The document is a draft.
 
@@ -246,6 +246,7 @@
 year
 month
 day
+day-of-month
 day-of-week
 week
 week-year



r31702 -[S06] ss/is context/is dynamic/ fossil

2010-07-15 Thread pugs-commits
Author: lwall
Date: 2010-07-15 19:24:08 +0200 (Thu, 15 Jul 2010)
New Revision: 31702

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] ss/is context/is dynamic/ fossil


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-15 17:21:19 UTC (rev 31701)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-15 17:24:08 UTC (rev 31702)
@@ -457,7 +457,7 @@
 
 Similarly, you may define dynamically scoped subroutines:
 
-my sub myfunc ($x) is context { ... }
+my sub myfunc ($x) is dynamic { ... }
 my sub *myfunc ($x) { ... }# same thing
 
 This may then be invoked via the syntax for dynamic variables:



r31678 -[S32/Temporal] DateTime.new(Numeric) - DateTime.new(Int), since time no longer returns fractional seconds.

2010-07-14 Thread pugs-commits
Author: Kodi
Date: 2010-07-14 16:02:34 +0200 (Wed, 14 Jul 2010)
New Revision: 31678

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] DateTime.new(Numeric) - DateTime.new(Int), since time no longer 
returns fractional seconds.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-14 12:50:51 UTC 
(rev 31677)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-14 14:02:34 UTC 
(rev 31678)
@@ -15,8 +15,8 @@
 
 Created: 19 Mar 2009
 
-Last Modified: 12 Jul 2010
-Version: 10
+Last Modified: 14 Jul 2010
+Version: 11
 
 The document is a draft.
 
@@ -57,7 +57,7 @@
 
 =head1 Ctime
 
-Returns the current POSIX time as an Int. Use the Cnow function for an
+Returns the current POSIX time as an CInt. Use Cnow for an
 epoch-agnostic measure of atomic seconds (i.e., an CInstant).
 Note that both Ctime and Cnow are not functions, but terms
 of the pseudo-constant variety; as such they never take an argument.
@@ -68,15 +68,14 @@
 
 A CDateTime object describes the time as it would appear on someone's
 calendar and someone's clock. You can create a CDateTime object from an
-CInstant or from any object that does the CNumeric role; in the latter
-case, the argument is interpreted as POSIX time.
+CInstant or from an CInt; in the latter case, the argument is
+interpreted as POSIX time.
 
 my $now = DateTime.new(now);
-my $now = DateTime.new(time); # same thing (usually)
+my $now = DateTime.new(time);
 
-Note that a CDateTime based on Cnow can return a CDateTime
-that cannot be produced using Ctime, since Ctime doesn't know
-about leap seconds.
+These two statements are equivalent except that Ctime doesn't know about
+leap seconds or fractions of seconds.
 
 Or you can use named arguments:
 



r31680 -[S32/Temporal] Added to Date: There are also Cweek, Cweek-year, Cweek-number, Cweekday-of-month, and Cday-of-year methods, which work just like their DateTime equivalents.

2010-07-14 Thread pugs-commits
Author: Kodi
Date: 2010-07-14 16:35:46 +0200 (Wed, 14 Jul 2010)
New Revision: 31680

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Added to Date: There are also Cweek, Cweek-year, 
Cweek-number, Cweekday-of-month, and Cday-of-year methods, which work 
just like their DateTime equivalents.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-14 14:35:21 UTC 
(rev 31679)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-14 14:35:46 UTC 
(rev 31680)
@@ -16,7 +16,7 @@
 Created: 19 Mar 2009
 
 Last Modified: 14 Jul 2010
-Version: 11
+Version: 12
 
 The document is a draft.
 
@@ -244,6 +244,9 @@
 $d.days-in-month# 31
 $d.Str  # '2010-12-24'
 
+There are also Cweek, Cweek-year, Cweek-number, Cweekday-of-month,
+and Cday-of-year methods, which work just like their DateTime equivalents.
+
 =head2 Arithmetics
 
 $d.succ # Date.new('2010-12-25')



r31689 -[S32/Temporal] Permit days-in-month and is-leap-year on DateTimes, too.

2010-07-14 Thread pugs-commits
Author: Kodi
Date: 2010-07-14 23:18:42 +0200 (Wed, 14 Jul 2010)
New Revision: 31689

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Permit days-in-month and is-leap-year on DateTimes, too.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-14 20:35:20 UTC 
(rev 31688)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-14 21:18:42 UTC 
(rev 31689)
@@ -16,7 +16,7 @@
 Created: 19 Mar 2009
 
 Last Modified: 14 Jul 2010
-Version: 12
+Version: 13
 
 The document is a draft.
 
@@ -157,9 +157,17 @@
 month, the day itself included. For example, June 9, 2003 is the second
 Monday of the month, and so this method returns 2 for that day.
 
+The Cdays-in-month method returns the number of days in the current
+month of the current year. So in the case of January, Cdays-in-month
+always returns 31, whereas in the case of February, Cdays-in-month
+returns 28 or 29 depending on the year.
+
 The Cday-of-year method returns the day of the year, a value between 1
 and 366.
 
+The method Cis-leap-year returns a CBool, which is true if and only
+if the current year is a leap year in the Gregorian calendar.
+
 The method Cwhole-second returns the second truncated to an integer.
 
 The CDate method returns a CDate object, and is the same as
@@ -232,20 +240,23 @@
 
 =head2 Accessors
 
-The following accessors are pretty obvious, and are defined by example only.
-See the test suite for more formal definitions.
+CDate objects support all of the following accessors, which work just
+like their CDateTime equivalents:
 
-my $d = Date.new('2010-12-24');
-$d.year # 2010
-$d.month# 12
-$d.day  # 24
-$d.day-of-week  # 5 # Friday
-$d.is-leap-year # Bool::False
-$d.days-in-month# 31
-$d.Str  # '2010-12-24'
+year
+month
+day
+day-of-week
+week
+week-year
+week-number
+day-of-week
+weekday-of-month
+days-in-month
+day-of-year
+is-leap-year
 
-There are also Cweek, Cweek-year, Cweek-number, Cweekday-of-month,
-and Cday-of-year methods, which work just like their DateTime equivalents.
+The Str method returns a string of the form '-mm-dd'.
 
 =head2 Arithmetics
 



r31690 -[S04] revise catcher semantics semantics to allow $!.handled = 1 to work as well as case match

2010-07-14 Thread pugs-commits
Author: lwall
Date: 2010-07-15 01:32:07 +0200 (Thu, 15 Jul 2010)
New Revision: 31690

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
[S04] revise catcher semantics semantics to allow $!.handled = 1 to work as 
well as case match


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2010-07-14 21:18:42 UTC (rev 31689)
+++ docs/Perl6/Spec/S04-control.pod 2010-07-14 23:32:07 UTC (rev 31690)
@@ -13,8 +13,8 @@
 
 Created: 19 Aug 2004
 
-Last Modified: 12 Jul 2010
-Version: 101
+Last Modified: 14 Jul 2010
+Version: 102
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -993,18 +993,46 @@
 default {...}
 }
 
-you're really getting something more like:
+you're really calling into a Icatch lambda that looks like:
 
-CATCH {
-when Mumble {...}
-default {...}
+- $! {
+my $SUCCEEDED = 1; # assume we will handle it
 
-leave(Failure);
+given $! {
+when Mumble {...}
+default {...}
+$SUCCEEDED = 0;# unassume we handled it
+}
 
-KEEP (die(Pending exceptions not handled in $!) unless 
all($!.pending».handled); $!.handled = 1);
-UNDO die $!;
+# the user may handle exception either by
+#  1. pattern matching in the given
+#  2. explicitly setting $!.handled = 1
+$!.handled = 1 if $SUCCEEDED;
+
+# conjecture: this might be enforced by the exception thrower instead
+if $!.handled {
+$!.wrap-die(Pending exceptions not handled) unless 
all($!.pending».handled);
+}
+
+$!;
 }
 
+The exception thrower looks up the call stack for a catch lambda
+that returns the exception object as handled, and then it is happy,
+and unwinds the stack to that point.  If the exception is returned
+as not handled. the exception thrower keeps looking for a higher
+dynamic scope for a spot to unwind to.  Note that any Cdie in the
+catch lambda rethrows outside the lambda as a new exception, wrapping
+up the old exception in its new pending list.  In this case the lambda
+never finishes executing.  Resumable exceptions may or may not leave
+normally depending on the implementation.  If continuations are used,
+the C$!.resume call will simply goto the continuation in question,
+and the lambda's callframe is abandoned.  Resumable exceptions may also
+be implemented by simply marking the C$! exception as resumed,
+in which case the original exception thrower simply returns to
+the code that threw the resumable exception, rather than unwinding
+before returning.
+
 A CCATCH block sees the lexical scope in which it was defined, but
 its caller is the dynamic location that threw the exception.  That is,
 the stack is not unwound until some exception handler chooses to
@@ -1013,7 +1041,7 @@
 CCATCH block to catch its own exception recursively forever.  However,
 a CCATCH must not behave that way, so we say that a CCATCH block
 never attempts to handle any exception thrown within its own dynamic scope.
-(Otherwise the Cdie in the previous paragraph would never work.)
+(Otherwise any Cdie would cause an infinite loop.)
 
 =head1 Control Exceptions
 
@@ -1132,7 +1160,11 @@
 that the semantics would be preserved by merely printing out the
 error and going on.  Since all exception handlers run in the dynamic
 scope of the throw, that reduces to simply returning from the Cwarn
-function most of the time.
+function most of the time.  See previous section for discussion of
+ways to return from catch lambdas.  The control lambda is logically
+separate from the catch lambda, though an implementation is allowed
+to combine them if it is careful to retain separate semantics for
+catch and control exceptions.
 
 =head1 The goto statement
 Xgoto



r31691 -[S04] more bombastic utterances about not dropping pending exceptions

2010-07-14 Thread pugs-commits
Author: lwall
Date: 2010-07-15 01:53:05 +0200 (Thu, 15 Jul 2010)
New Revision: 31691

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
[S04] more bombastic utterances about not dropping pending exceptions


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2010-07-14 23:32:07 UTC (rev 31690)
+++ docs/Perl6/Spec/S04-control.pod 2010-07-14 23:53:05 UTC (rev 31691)
@@ -1043,6 +1043,16 @@
 never attempts to handle any exception thrown within its own dynamic scope.
 (Otherwise any Cdie would cause an infinite loop.)
 
+Any attempt to throw a fatal exception past an already active exception
+handler must guarantee to steal the existing fatal exception (plus
+any pending exceptions it contains) and add all those to the new
+exception's pending list.  (This does not apply to control exceptions
+described in the next section.)  When the new exception is handled,
+it must also deal with the list of pending exceptions, or the Cwrap-die
+mentioned above will throw a Pending exceptions not handled at that point.
+Even this does not discard the pending exceptions, so in the final outermost
+message, all non-handled exceptions are guaranteed to be listed.
+
 =head1 Control Exceptions
 
 All abnormal control flow is, in the general case, handled by the



r31645 -[S04] try to nail down CATCH exit semantics a bit more water-tightly

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-12 21:52:08 +0200 (Mon, 12 Jul 2010)
New Revision: 31645

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
[S04] try to nail down CATCH exit semantics a bit more water-tightly


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2010-07-12 17:51:44 UTC (rev 31644)
+++ docs/Perl6/Spec/S04-control.pod 2010-07-12 19:52:08 UTC (rev 31645)
@@ -13,8 +13,8 @@
 
 Created: 19 Aug 2004
 
-Last Modified: 9 Jul 2010
-Version: 100
+Last Modified: 12 Jul 2010
+Version: 101
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -986,6 +986,25 @@
 it treats code inside a Cdefault block differently from code that's after
 all the Cwhen blocks but not in a Cdefault block.
 
+More specifically, when you write:
+
+CATCH {
+when Mumble {...}
+default {...}
+}
+
+you're really getting something more like:
+
+CATCH {
+when Mumble {...}
+default {...}
+
+leave(Failure);
+
+KEEP (die(Pending exceptions not handled in $!) unless 
all($!.pending».handled); $!.handled = 1);
+UNDO die $!;
+}
+
 A CCATCH block sees the lexical scope in which it was defined, but
 its caller is the dynamic location that threw the exception.  That is,
 the stack is not unwound until some exception handler chooses to



r31649 -[S02] typo for jnthn++

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-13 01:50:39 +0200 (Tue, 13 Jul 2010)
New Revision: 31649

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[S02] typo for jnthn++


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-12 21:25:25 UTC (rev 31648)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-12 23:50:39 UTC (rev 31649)
@@ -4598,7 +4598,7 @@
 statement_mod_loop:symfor.say for 1..10
 statement_prefix:symgather   gather for @foo { .take }
 term:sym!!!  $x = { !!! }
-trait_does:symdoes   my $x does Freezable
+trait_mod:symdoesmy $x does Freezable
 twigil:sym?  $?LINE
 type_declarator:symsubsetsubset Nybble of Int where 
^16
 



r31650 -[S06] add .args to what a context can return

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-13 01:51:27 +0200 (Tue, 13 Jul 2010)
New Revision: 31650

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] add .args to what a context can return


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-12 23:50:39 UTC (rev 31649)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-12 23:51:27 UTC (rev 31650)
@@ -2469,6 +2469,7 @@
 .line
 .my
 .hints
+.args
 
 The C.callframe and C.caller methods work the same as the functions
 except that they are relative to the frame supplied as invocant.



r31652 -[Temporal] time is now a pseudo-constant like now, rand, etc

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-13 02:06:01 +0200 (Tue, 13 Jul 2010)
New Revision: 31652

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[Temporal] time is now a pseudo-constant like now, rand, etc


Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-12 23:59:37 UTC 
(rev 31651)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-13 00:06:01 UTC 
(rev 31652)
@@ -15,8 +15,8 @@
 
 Created: 19 Mar 2009
 
-Last Modified: 11 July 2010
-Version: 8
+Last Modified: 12 Jul 2010
+Version: 9
 
 The document is a draft.
 
@@ -57,6 +57,10 @@
 
 Returns the current POSIX time. Use the Cnow function for an
 epoch-agnostic measure of atomic seconds (i.e., an CInstant).
+Note that both Ctime and Cnow are not functions, but terms
+of the pseudo-constant variety; as such they never take an argument.
+Saying Ctime() doesn't work unless you happen to have a function
+of that name defined.
 
 =head1 CDateTime
 



r31654 -[S06] defined callsame/nextsame in terms of callwith/nextwith and callframe

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-13 02:13:42 +0200 (Tue, 13 Jul 2010)
New Revision: 31654

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] defined callsame/nextsame in terms of callwith/nextwith and callframe


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-13 00:06:32 UTC (rev 31653)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-13 00:13:42 UTC (rev 31654)
@@ -16,8 +16,8 @@
 
 Created: 21 Mar 2003
 
-Last Modified: 10 Jul 2010
-Version: 140
+Last Modified: 12 Jul 2010
+Version: 141
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -2663,7 +2663,11 @@
 The Ccallwith function lets you pass your own arguments to the wrapped
 function.  The Ccallsame function takes no argument; it
 implicitly passes the original argument list through unchanged.
+The Ccallsame and Cnextsame functions are really short for:
 
+callwith( |callframe(Routine).args )
+nextwith( |callframe(Routine).args )
+
 The call to C.wrap replaces the original CRoutine's Cdo property with 
the CCallable
 argument, and arranges that any call to Ccallsame, Ccallwith,
 Cnextsame or Cnextwith invokes the previous version of the



r31655 -[S02] revise blob literals a bit

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-13 02:44:10 +0200 (Tue, 13 Jul 2010)
New Revision: 31655

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[S02] revise blob literals a bit


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-13 00:13:42 UTC (rev 31654)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-13 00:44:10 UTC (rev 31655)
@@ -1350,6 +1350,7 @@
 
 blob1   Blob[bit], a bit string
 blob2   Blob[uint2], a DNA sequence?
+blob3   Blob[Uint[3]], an octal string
 blob4   Blob[uint4], a hex string
 blob8   Blob[uint8], a byte string
 blob16  Blob[uint16]
@@ -3189,16 +3190,14 @@
 
 =item *
 
-Blob literals look similar to integer literals with radix markers, but are
-distinct in their details.  A Blob literal has 1 format with 3 radix
-options:
+CBlob literals look similar to integer literals with radix markers, but use
+curlies instead of angles:
 
-0b00101110100010  base 2, 1 bit per column
-0o523504376   base 8, 3 bits per column
-0xA705E   base 16, 4 bits per column
+:2{0010_1110_1000_10}   a blob1, base 2, 1 bit per column
+:8{5235 0437 6} a blob3, 3 bits per column
+:16{A705E}  a blob4, 4 bits per column
 
-TODO:  Expand this for more generality.  Meanwhile, this existing
-definition covers the common cases of specifying in bits and hexits.
+Whitespace and underscores are allowed but ignored.
 
 =item *
 



r31656 -[S12] define more forced actions on enum values

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-13 02:55:37 +0200 (Tue, 13 Jul 2010)
New Revision: 31656

Modified:
   docs/Perl6/Spec/S12-objects.pod
Log:
[S12] define more forced actions on enum values


Modified: docs/Perl6/Spec/S12-objects.pod
===
--- docs/Perl6/Spec/S12-objects.pod 2010-07-13 00:44:10 UTC (rev 31655)
+++ docs/Perl6/Spec/S12-objects.pod 2010-07-13 00:55:37 UTC (rev 31656)
@@ -13,8 +13,8 @@
 
 Created: 27 Oct 2004
 
-Last Modified: 11 Jul 2010
-Version: 106
+Last Modified: 12 Jul 2010
+Version: 107
 
 =head1 Overview
 
@@ -1693,9 +1693,16 @@
 
 Fri.WHAT# Day, not Int.
 +Fri# 5
+Fri.Numeric # 5
 Fri ~~ Int  # True, because derived from Int
 Fri.perl# 'Day::Fri'
+~Fri# 'Fri'
+Fri.Stringy # 'Fri'
+Fri.Str # 'Day::Fri' (used by say/print)
 Fri.key # 'Fri'
+Fri.value   # 5
+Fri.pair# :Fri(5)
+Fri.kv  # 'Fri', 5
 Fri.defined # True
 
 Other than that, number valued enums act just like numbers, while



r31657 -add 2-bits/col blob example

2010-07-12 Thread pugs-commits
Author: Darren_Duncan
Date: 2010-07-13 02:58:57 +0200 (Tue, 13 Jul 2010)
New Revision: 31657

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
add 2-bits/col blob example

Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-13 00:55:37 UTC (rev 31656)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-13 00:58:57 UTC (rev 31657)
@@ -3194,6 +3194,7 @@
 curlies instead of angles:
 
 :2{0010_1110_1000_10}   a blob1, base 2, 1 bit per column
+:4{}a blob2, 2 bits per column
 :8{5235 0437 6} a blob3, 3 bits per column
 :16{A705E}  a blob4, 4 bits per column
 



r31659 -[S02] s/Uint/uint/ for speculative native role

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-13 03:36:05 +0200 (Tue, 13 Jul 2010)
New Revision: 31659

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[S02] s/Uint/uint/ for speculative native role


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-13 01:08:45 UTC (rev 31658)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-13 01:36:05 UTC (rev 31659)
@@ -1350,7 +1350,7 @@
 
 blob1   Blob[bit], a bit string
 blob2   Blob[uint2], a DNA sequence?
-blob3   Blob[Uint[3]], an octal string
+blob3   Blob[uint[3]], an octal string
 blob4   Blob[uint4], a hex string
 blob8   Blob[uint8], a byte string
 blob16  Blob[uint16]



r31660 -[S32] revert Ctime to POSIX integer seconds; don't try to do Cnow's job

2010-07-12 Thread pugs-commits
Author: lwall
Date: 2010-07-13 03:36:39 +0200 (Tue, 13 Jul 2010)
New Revision: 31660

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32] revert Ctime to POSIX integer seconds; don't try to do Cnow's job


Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-13 01:36:05 UTC 
(rev 31659)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-13 01:36:39 UTC 
(rev 31660)
@@ -16,7 +16,7 @@
 Created: 19 Mar 2009
 
 Last Modified: 12 Jul 2010
-Version: 9
+Version: 10
 
 The document is a draft.
 
@@ -50,12 +50,14 @@
 
 Note that in this document, the term POSIX time means the number of
 seconds since midnight UTC of 1 January 1970, not counting leap seconds.
-This is the same as the output of the ISO C Ctime function except that it
-also includes a fractional part.
+This is the same as the output of the ISO C Ctime function.
+Unlike in Perl 5, Ctime does not return fractional seconds, since CPOSIX
+does not define the concept during leap seconds.  You want
+to use Cnow for that instead.
 
 =head1 Ctime
 
-Returns the current POSIX time. Use the Cnow function for an
+Returns the current POSIX time as an Int. Use the Cnow function for an
 epoch-agnostic measure of atomic seconds (i.e., an CInstant).
 Note that both Ctime and Cnow are not functions, but terms
 of the pseudo-constant variety; as such they never take an argument.
@@ -70,8 +72,12 @@
 case, the argument is interpreted as POSIX time.
 
 my $now = DateTime.new(now);
-my $now = DateTime.new(time); # same thing
+my $now = DateTime.new(time); # same thing (usually)
 
+Note that a CDateTime based on Cnow can return a CDateTime
+that cannot be produced using Ctime, since Ctime doesn't know
+about leap seconds.
+
 Or you can use named arguments:
 
 my $moonlanding = DateTime.new( :year(1969), :month(7), :day(16),



r31624 -[S05] redirect to new char class syntax with patch from cosimo++

2010-07-11 Thread pugs-commits
Author: lwall
Date: 2010-07-11 18:53:20 +0200 (Sun, 11 Jul 2010)
New Revision: 31624

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] redirect to new char class syntax with patch from cosimo++


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-07-11 12:05:45 UTC (rev 31623)
+++ docs/Perl6/Spec/S05-regex.pod   2010-07-11 16:53:20 UTC (rev 31624)
@@ -16,8 +16,8 @@
 
 Created: 24 Jun 2002
 
-Last Modified: 9 Jul 2010
-Version: 127
+Last Modified: 11 Jul 2010
+Version: 128
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them Iregex rather than regular
@@ -809,6 +809,9 @@
 C[...] is no longer a character class.
 It now delimits a non-capturing group.
 
+A character class is now specified using C [...] .
+See also LExtensible metasyntax.
+
 =item *
 
 C{...} is no longer a repetition quantifier.



r31625 -[S12] Nail down class representations sooner to make jnthn++ happier

2010-07-11 Thread pugs-commits
Author: lwall
Date: 2010-07-11 19:03:32 +0200 (Sun, 11 Jul 2010)
New Revision: 31625

Modified:
   docs/Perl6/Spec/S12-objects.pod
Log:
[S12] Nail down class representations sooner to make jnthn++ happier


Modified: docs/Perl6/Spec/S12-objects.pod
===
--- docs/Perl6/Spec/S12-objects.pod 2010-07-11 16:53:20 UTC (rev 31624)
+++ docs/Perl6/Spec/S12-objects.pod 2010-07-11 17:03:32 UTC (rev 31625)
@@ -13,8 +13,8 @@
 
 Created: 27 Oct 2004
 
-Last Modified: 10 Jul 2010
-Version: 105
+Last Modified: 11 Jul 2010
+Version: 106
 
 =head1 Overview
 
@@ -2031,6 +2031,31 @@
 The application may only request that the optimizer close and finalize
 unmarked classes.
 
+=head1 Representations
+
+By default Perl 6 assumes that all objects have a representation
+of CP6opaque.  This may be overridden with a trait:
+
+class Mammal is repr(P6Hash) {...}
+
+Whether implicit or explicit, the representation is considered to be
+fixed for the class after declaration, and the optimizer is free to
+optimize based on this guarantee.  It is illegal to create an object
+of the same type with any other representation.  If you wish to allow
+objects to be created with run-time specified representations, you
+must specifically pessimize the class:
+
+class Mammal is repr(*) {...}
+
+All non-native representations are required to support undefined type
+objects that may contain unthrown exceptions (CFailure objects);
+while this can be implemented using an alternate representation,
+Perl 6 doesn't think of it that way.  All normal objects in Perl 6
+may be used as a specific object (proper noun) if they are defined,
+or as a generic object (common noun) whether or not they are defined.
+You get this representation polymorphism for free independently of
+the restriction above.
+
 =head1 Interface Consistency
 
 By default, all methods and submethods that do not declare an explicit
@@ -2142,7 +2167,7 @@
 parents   list of parent classes
 roles list of roles
 disambig  how to deal with ambiguous method names from roles
-layoutP6opaque, P6hash, P5hash, P5array, PyDict, Cstruct, etc.
+repr  P6opaque, P6hash, P5hash, P5array, PyDict, Cstruct, etc.
 
 These are for the standard Perl 6 Meta-Object Protocol, but other MOPs
 may define other traits.  The identifier should probably be accessed



r31626 -[S12] discuss pessimizing optimizations with augment

2010-07-11 Thread pugs-commits
Author: lwall
Date: 2010-07-11 19:09:44 +0200 (Sun, 11 Jul 2010)
New Revision: 31626

Modified:
   docs/Perl6/Spec/S12-objects.pod
Log:
[S12] discuss pessimizing optimizations with augment


Modified: docs/Perl6/Spec/S12-objects.pod
===
--- docs/Perl6/Spec/S12-objects.pod 2010-07-11 17:03:32 UTC (rev 31625)
+++ docs/Perl6/Spec/S12-objects.pod 2010-07-11 17:09:44 UTC (rev 31626)
@@ -2047,6 +2047,13 @@
 
 class Mammal is repr(*) {...}
 
+An Caugment is allowed to do this as long as it is before the
+main CCHECK time, at which point the compiler commits to its
+optimization strategies.  Compilers are not required to support
+run-time pessimizations (though they may).  Compilers may also generate
+both optimal and pessimal code paths and choose which to run based
+on run-time information, as long as correct semantics are maintained.
+
 All non-native representations are required to support undefined type
 objects that may contain unthrown exceptions (CFailure objects);
 while this can be implemented using an alternate representation,



r31627 -[S32/Temporal] Changed to use a different way of specifying time zones, which is hopefully saner than my last proposal.

2010-07-11 Thread pugs-commits
Author: Kodi
Date: 2010-07-11 19:56:33 +0200 (Sun, 11 Jul 2010)
New Revision: 31627

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Changed to use a different way of specifying time zones, which 
is hopefully saner than my last proposal.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-11 17:09:44 UTC 
(rev 31626)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-11 17:56:33 UTC 
(rev 31627)
@@ -15,8 +15,8 @@
 
 Created: 19 Mar 2009
 
-Last Modified: 8 Apr 2010
-Version: 7
+Last Modified: 11 July 2010
+Version: 8
 
 The document is a draft.
 
@@ -88,11 +88,12 @@
 All four of the aforementioned forms of Cnew accept two additional named
 arguments. C:formatter is a callable object that takes a CDateTime and
 returns a string. The default formatter creates an ISO 8601 timestamp (see
-below). C:timezone is a callable object that takes a CDateTime and
-returns a two-element list giving the difference from UTC in (possibly both
-negative, but not of opposite signs) hours and minutes. Alternatively,
-C:timezone can be a two-element list, which is interpreted as a static
-offset from UTC. The default time zone is C(0, 0) (i.e., UTC).
+below). C:timezone is a callable object that takes a CDateTime to
+convert and a CBool that specifies the direction of the conversion: to
+UTC if true, from UTC if false. The C:timezone signifies the necessary
+conversion by returning an integer giving the difference from UTC in
+seconds. Alternatively, C:timezone can be a number, which is interpreted
+as a static offset from UTC. The default time zone is C0 (i.e., UTC).
 
 A shorter way to send in date and time information is to provide a
 single string with a full ISO 8601 date and time. The example from above
@@ -100,14 +101,16 @@
 
 my $moonlanding = DateTime.new( '1969-07-16T20:17:00Z' ); # UTC time
 
-The general form is C[date]T[time][offset], with [date] given as
-C-MM-DD and [time] given as Chh:mm:ss. The final CZ is a short
+The general form is C[date]T[time][offset], with C[date] given as
+C-MM-DD and C[time] given as Chh:mm:ss. The final CZ is a short
 form for C+, meaning UTC. (Note that while this form of Cnew
 accepts all of C+, C-, and CZ, the default formatter for
-CDateTime always expresses UTC as CZ.) The general notation for the C
-offset  is C+hhmm or C-hhmm. As before, a C:formatter argument is
-permitted. The C:timezone, if not supplied, is assumed to be a static
-offset equal to the offset in the given timestamp.
+CDateTime always expresses UTC as CZ.) The general notation for the
+C[offset] is C+hhmm or C-hhmm. The time zone of the new object is
+assumed to be a static offset equal to the C[offset]. The C[offset] is
+optional; if omitted, a C:timezone argument is permitted; if this too is
+omitted, UTC is assumed. Finally, the constructor also accepts a
+C:formatter argument.
 
 With all the above constructors, if you attempt to pass in values that
 are outside of the ranges specified in the list above, you'll get an
@@ -155,8 +158,8 @@
 
 The method Coffset returns the object's current offset from UTC: if
 C$dt.timezone does CCallable, C$dt.offset is equivalent to
-C$dt.timezone($dt); otherwise, C$dt.offset is equivlent to
-C@($dt.timezone).
+C$dt.timezone($dt, True); otherwise, C$dt.offset returns
+C$dt.timezone as is.
 
 =head2 Set methods
 
@@ -181,9 +184,9 @@
 local time zone is adjusted accordingly:
 
 my $dt = DateTime.new('2005-02-01T15:00:00+0900');
-say $dt.hour; # 15
-$dt.timezone = (6, 0);
-say $dt.hour; # 12
+say $dt.hour;# 15
+$dt.timezone = 6 * 60 * 60;  # 6 hours ahead of UTC
+say $dt.hour;# 12
 
 The Ctruncate method allows you to clear a number of time values
 below a given resolution:
@@ -197,6 +200,9 @@
 Monday of the week in which it occurs, and the time components are all
 set to 0.
 
+For the convenience of method chaining, Cset and Ctruncate return the
+calling object.
+
 =head1 Date
 
 CDate objects are immutable and represent a day without a time component.



r31630 -S02 : add initial formats for Blob (or Buf) literals

2010-07-11 Thread pugs-commits
Author: Darren_Duncan
Date: 2010-07-12 03:01:55 +0200 (Mon, 12 Jul 2010)
New Revision: 31630

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
S02 : add initial formats for Blob (or Buf) literals

Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-11 22:26:48 UTC (rev 31629)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-12 01:01:55 UTC (rev 31630)
@@ -13,8 +13,8 @@
 
 Created: 10 Aug 2004
 
-Last Modified: 9 Jul 2010
-Version: 218
+Last Modified: 11 Jul 2010
+Version: 219
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -3189,6 +3189,19 @@
 
 =item *
 
+Blob literals look similar to integer literals with radix markers, but are
+distinct in their details.  A Blob literal has 1 format with 3 radix
+options:
+
+0b00101110100010  base 2, 1 bit per column
+0o523504376   base 8, 3 bits per column
+0xA705E   base 16, 4 bits per column
+
+TODO:  Expand this for more generality.  Meanwhile, this existing
+definition covers the common cases of specifying in bits and hexits.
+
+=item *
+
 Characters indexed by hex numbers can be interpolated into strings
 by introducing with C\x, followed by either a bare hex number
 (C\x263a) or a hex number in square brackets (C\x[263a]).



r31611 -[spec] random cleanup of fossils from before proto became a multi wrapper

2010-07-10 Thread pugs-commits
Author: lwall
Date: 2010-07-10 08:43:17 +0200 (Sat, 10 Jul 2010)
New Revision: 31611

Modified:
   docs/Perl6/Spec/S02-bits.pod
   docs/Perl6/Spec/S06-routines.pod
   docs/Perl6/Spec/S09-data.pod
   docs/Perl6/Spec/S10-packages.pod
   docs/Perl6/Spec/S11-modules.pod
   docs/Perl6/Spec/S12-objects.pod
   docs/Perl6/Spec/S13-overloading.pod
Log:
[spec] random cleanup of fossils from before proto became a multi wrapper


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-07-09 22:59:12 UTC (rev 31610)
+++ docs/Perl6/Spec/S02-bits.pod2010-07-10 06:43:17 UTC (rev 31611)
@@ -13,8 +13,8 @@
 
 Created: 10 Aug 2004
 
-Last Modified: 2 Jun 2010
-Version: 217
+Last Modified: 9 Jul 2010
+Version: 218
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1748,9 +1748,9 @@
 of that name.  Conversely, C$x.substr implies conversion to a string
 or buffer type.
 
-The CCool namespace also contains all multimethods of last resort;
+The CCool module also contains all multisubs of last resort;
 these are automatically searched if normal multiple dispatch does not
-find a viable candidate.  Note that the CCool namespace is mutable,
+find a viable candidate.  Note that the CCool package is mutable,
 and both single and multiple dispatch must take into account changes
 there for the purposes of run-time monkey patching.  However, since
 the multiple dispatcher uses the CCool package only as a failover,
@@ -2271,20 +2271,23 @@
 
 =item *
 
-With multiple dispatch, Cfoo may actually be the name of a set
-of candidate functions (which you can use as if it were an ordinary function).
+With multiple dispatch, Cfoo is actually the name of the Cproto 
controlling a set
+of candidate functions (which you can use as if it were an ordinary function, 
because
+a Cproto is really an Conly function with pretentions to management of a 
dispatcher).
 However, in that case Cfoo by itself is not sufficient to uniquely
 name a specific function.  To do that, the type may be refined by
 using a signature literal as a postfix operator:
 
 foo:(Int,Num)
 
-It still just returns the CRoutine object.  A call may also be partially
+Use of a signature that does not unambiguously select a single multi results in
+failure.
+
+It still just returns a CRoutine object.  A call may also be partially
 applied by using the C.assuming method:
 
 foo.assuming(1,2,3,:miceblind)
 
-
 =item *
 
 Slicing syntax is covered in S09.  A multidimensional

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-09 22:59:12 UTC (rev 31610)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-10 06:43:17 UTC (rev 31611)
@@ -17,7 +17,7 @@
 Created: 21 Mar 2003
 
 Last Modified: 9 Jul 2010
-Version: 138
+Version: 139
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -63,7 +63,8 @@
 also adds an implicit Cmulti to all routines of the same short
 name within its scope, unless they have an explicit modifier.
 (This is particularly useful when adding to rule sets or when attempting
-to compose conflicting methods from roles.)
+to compose conflicting methods from roles.)  Abstractly, the Cproto
+is a wrapper around the dispatch to the Cmulti.s
 
 BOnly (keyword: Conly) routines do not share their short names
 with other routines.  This is the default modifier for all routines,
@@ -85,13 +86,13 @@
 
 When you call any routine (or method, or rule) that may have multiple
 candidates, the Cproto is always called first (at least in the abstract--this
-can often be optimized away).  In essence, a proto is dispatched exactly like
-an Conly sub, but the proto itself may delegate to any of the candidates
+can often be optimized away).  In essence, a Cproto is dispatched exactly 
like
+an Conly sub, but the Cproto itself may delegate to any of the candidates
 it is managing.
 
-It is the proto's responsibility to first vet the arguments for all the
+It is the Cproto's responsibility to first vet the arguments for all the
 candidates; any call that does not match the proto's signature fails outright.
-Named arguments that bind to positionals in the proto sig will become 
positionals
+Named arguments that bind to positionals in the Cproto sig will become 
positionals
 for all subsequent calls to its managed multis.
 
 The proto then builds (or otherwise acquires) a list of its managed candidates
@@ -100,50 +101,51 @@
 for each of the various dispatchers.
 
 This default behavior is implied by a block containing of a single
-C* (that is, a whatever).  Hence the typical proto will simply
+C* (that is, a whatever).  Hence the typical Cproto will simply
 have a body of C{*}.
 
 proto method bar {*}
 
 (We don't use 

r31613 -[specs] add Calso declarator to prefix any trait to be applied to the outer declaration

2010-07-10 Thread pugs-commits
Author: lwall
Date: 2010-07-10 19:21:35 +0200 (Sat, 10 Jul 2010)
New Revision: 31613

Modified:
   docs/Perl6/Spec/S06-routines.pod
   docs/Perl6/Spec/S12-objects.pod
   docs/Perl6/Spec/S14-roles-and-parametric-types.pod
   docs/Perl6/Spec/S17-concurrency.pod
Log:
[specs] add Calso declarator to prefix any trait to be applied to the outer 
declaration
this lets us say also is Int without the 'is' conflicting with Test's is 
function
and it's extensible as new trait_mods are added


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-10 17:17:14 UTC (rev 31612)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-10 17:21:35 UTC (rev 31613)
@@ -16,8 +16,8 @@
 
 Created: 21 Mar 2003
 
-Last Modified: 9 Jul 2010
-Version: 139
+Last Modified: 10 Jul 2010
+Version: 140
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -1859,9 +1859,9 @@
 adverbial syntax, except that that colon may be omitted or doubled depending
 on the degree of ambiguity desired:
 
-is ::Foo[...]   # definitely a parameterized typename
-is :Foo[...]# definitely a pair with a list
-is Foo[...] # depends on whether Foo is predeclared as type
+sub x() is ::Foo[...]   # definitely a parameterized typename
+sub x() is :Foo[...]# definitely a pair with a list
+sub x() is Foo[...] # depends on whether Foo is predeclared as type
 
 =over
 

Modified: docs/Perl6/Spec/S12-objects.pod
===
--- docs/Perl6/Spec/S12-objects.pod 2010-07-10 17:17:14 UTC (rev 31612)
+++ docs/Perl6/Spec/S12-objects.pod 2010-07-10 17:21:35 UTC (rev 31613)
@@ -13,8 +13,8 @@
 
 Created: 27 Oct 2004
 
-Last Modified: 9 Jul 2010
-Version: 104
+Last Modified: 10 Jul 2010
+Version: 105
 
 =head1 Overview
 
@@ -137,14 +137,20 @@
 
 class Dog is Mammal does Pet {...}
 
-You may put these inside as well:
+You may put these inside as well by use of the Calso declarator:
 
 class Dog {
-is Mammal;
-does Pet;
+also is Mammal;
+also does Pet;
 ...
 }
 
+(However, the Calso declarator is primarily intended for use
+in roles, to distinguish class traits that might not be properly
+understood as generic when placed in the role header, which tends to
+communicate the false impression that the trait in question is to be
+applied directly to the role rather than to the composed class.)
+
 Every object (including any class-based object) delegates to an instance of
 its metaclass.  You can get at the metaclass of any object via the
 CHOW method, which returns an instance of the metaclass.  A class object 
is just considered an empty

Modified: docs/Perl6/Spec/S14-roles-and-parametric-types.pod
===
--- docs/Perl6/Spec/S14-roles-and-parametric-types.pod  2010-07-10 17:17:14 UTC 
(rev 31612)
+++ docs/Perl6/Spec/S14-roles-and-parametric-types.pod  2010-07-10 17:21:35 UTC 
(rev 31613)
@@ -15,8 +15,8 @@
 
 Created: 24 Feb 2009 (extracted from S12-objects.pod)
 
-Last Modified: 8 Jul 2009
-Version: 8
+Last Modified: 10 Jul 2009
+Version: 9
 
 =head1 Overview
 
@@ -157,7 +157,7 @@
 that is considered an implementation detail:
 
 role Pet {
-is Friend;
+also is Friend;
 }
 
 =head2 Compile-time Composition
@@ -169,12 +169,19 @@
 or equivalently, within the body of the class closure:
 
 class Dog {
-is Mammal;
-does Pet;
-does Sentry;
+also is Mammal;
+also does Pet;
+also does Sentry;
 ...
 }
 
+or
+
+class Dog {
+also is Mammal does Pet does Sentry;
+...
+}
+
 There is no ordering dependency among the roles.
 
 A class's explicit method definition hides any role definition of

Modified: docs/Perl6/Spec/S17-concurrency.pod
===
--- docs/Perl6/Spec/S17-concurrency.pod 2010-07-10 17:17:14 UTC (rev 31612)
+++ docs/Perl6/Spec/S17-concurrency.pod 2010-07-10 17:21:35 UTC (rev 31613)
@@ -16,8 +16,8 @@
 
 Created: 13 Jun 2005
 
-Last Modified: 27 Feb 2009
-Version: 4
+Last Modified: 10 Jul 2010
+Version: 5
 
 This draft document is a paste together from various sources.  The bulk of it 
is simply
 the old S17-concurrency.pod, which dealt only with concurrency.  Signals were 
added from
@@ -188,7 +188,7 @@
 my $a2 = alarm(2);
 sleep 10;
 CATCH {
-is critical; # if you don't want $a2 to be raised inside this
+also is critical; # if you don't want $a2 to be raised inside this
 when Sig::ALARM { ... }
 }
 }
@@ -406,7 +406,7 @@
  }
 
  if ($update) {
- is critical;
+ also is critical;
  # code 

r31593 -[S05,S06] more refinements to {*}

2010-07-09 Thread pugs-commits
Author: lwall
Date: 2010-07-09 18:41:04 +0200 (Fri, 09 Jul 2010)
New Revision: 31593

Modified:
   docs/Perl6/Spec/S05-regex.pod
   docs/Perl6/Spec/S06-routines.pod
Log:
[S05,S06] more refinements to {*}


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-07-09 15:37:27 UTC (rev 31592)
+++ docs/Perl6/Spec/S05-regex.pod   2010-07-09 16:41:04 UTC (rev 31593)
@@ -16,8 +16,8 @@
 
 Created: 24 Jun 2002
 
-Last Modified: 8 Jul 2010
-Version: 126
+Last Modified: 9 Jul 2010
+Version: 127
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them Iregex rather than regular
@@ -1147,13 +1147,18 @@
 tie, a normal multiple dispatch is made using the arguments to the
 remaining variants, assuming they can be differentiated by type.
 
-The proto calls into the subdispatcher when it sees a C* that
-cannot be a quantifier and is the only thing in its bracket.  Therefore
+The Cproto calls into the subdispatcher when it sees a C* that
+cannot be a quantifier and is the only thing in its block.  Therefore
 you can put items before and after the subdispatch by putting
-the C* into square brackets:
+the C* into curlies:
 
-proto token foo { prestuff [*] poststuff }
+proto token foo { prestuff {*} poststuff }
 
+This works only in a proto.  See LS06 for a discussion of the
+semantics of C{*}.  (Unlike a proto sub, a proto regex
+automatically remembers the return values from C{*} because
+they are carried along with the match cursor.)
+
 =item *
 
 The use of a hash variable in patterns is reserved.

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-09 15:37:27 UTC (rev 31592)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-09 16:41:04 UTC (rev 31593)
@@ -16,8 +16,8 @@
 
 Created: 21 Mar 2003
 
-Last Modified: 8 Jul 2010
-Version: 136
+Last Modified: 9 Jul 2010
+Version: 137
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -99,7 +99,7 @@
 and dispatches them according to the rules of multiple dispatch as defined
 for each of the various dispatchers.
 
-This default behavior is implied by a statement consisting of a single
+This default behavior is implied by a block containing of a single
 C* (that is, a whatever).  Hence the typical proto will simply
 have a body of C{*}.
 
@@ -108,10 +108,10 @@
 (We don't use C... for that because it would fail at run time,
 and proto blocks are not stubs, but are intended to be executed.)
 
-Other statements may be inserted before and after the C*
+Other statements may be inserted before and after the C{*}
 statement to capture control before or after the multi dispatch:
 
-proto foo ($a,$b) { say Called with $a $b; *; say Returning; }
+proto foo ($a,$b) { say Called with $a $b; {*}; say Returning; }
 
 (That proto is only good for multis with side effects and no return
 value, since it returns the result of Csay, which might not be what
@@ -143,33 +143,45 @@
 Also, the old semantics of Cproto providing the most-default multi body
 is hereby deprecated.  Default multis should be marked with Cis default.
 
-It is still possible to provide default behavior in the proto, however, by
-use of Ccallsame rather than Cnextsame:
+It is still possible to provide default behavior in the proto, however:
 
-my proto sub foo () {
-do-something-before();
-my |$cap = (*);   # call into the managed set, then come back
-do-something-after();
-return |$cap;
+my proto sub foo (@args) {
+do-something-before(@args);
+{*}   # call into the managed set, then come back
+do-something-after(@args);
 }
 
-or more simply:
+Note that this returns the value of do-something-after(), not the multi.
+There are two ways to get around that.  Here's one way:
 
-my proto sub foo () {
-ENTER do-something-before();
-*; 
-LEAVE do-something-after();
+my proto sub foo (@args) {
+ENTER do-something-before(@args);
+{*}
+LEAVE do-something-after(@args);
 }
 
-Note that in the first example the C* must be placed into a
-context where it is a standalone statement in order to get its
-return value.
+Alternately, you can spell out what C{*} is actually sugar for,
+which would be some dispatcher macro such as:
 
+my proto sub foo (|$cap (@args)) {
+do-something-before(@args);
+my |$retval = MULTI-DISPATCH-CALLWITH($?ROUTINE,$cap);
+do-something-after(@args);
+return |$retval;
+}
+
+which optimizes (we hope) to an inlined multidispatcher to locate all
+the candidates for these arguments (hopefully memoized), create the dynamic
+scope of a dispatch, start the dispatch, manage Ccallnext and Clastcall
+semantics, and 

r31595 -[S06] = should be :=

2010-07-09 Thread pugs-commits
Author: lwall
Date: 2010-07-09 19:08:24 +0200 (Fri, 09 Jul 2010)
New Revision: 31595

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] = should be :=


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-09 16:51:08 UTC (rev 31594)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-09 17:08:24 UTC (rev 31595)
@@ -165,9 +165,9 @@
 
 my proto sub foo (|$cap (@args)) {
 do-something-before(@args);
-my |$retval = MULTI-DISPATCH-CALLWITH($?ROUTINE,$cap);
+my |$retcap := MULTI-DISPATCH-CALLWITH($?ROUTINE,$cap);
 do-something-after(@args);
-return |$retval;
+return |$retcap;
 }
 
 which optimizes (we hope) to an inlined multidispatcher to locate all



r31598 -[S32/Temporal] Clarified the distinction between time and now, specified what formatters and time zones should actually do, and dropped some formatting methods.

2010-07-09 Thread pugs-commits
Author: Kodi
Date: 2010-07-09 19:43:53 +0200 (Fri, 09 Jul 2010)
New Revision: 31598

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Clarified the distinction between time and now, specified what 
formatters and time zones should actually do, and dropped some formatting 
methods.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-09 17:12:58 UTC 
(rev 31597)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-09 17:43:53 UTC 
(rev 31598)
@@ -48,31 +48,32 @@
 are the aspects of time that are felt to be stable enough to belong in
 the core.
 
+Note that in this document, the term POSIX time means the number of
+seconds since midnight UTC of 1 January 1970, not counting leap seconds.
+This is the same as the output of the ISO C Ctime function except that it
+includes a fractional part.
+
 =head1 Ctime
 
-Returns an CInstant representing the current time as measured in
-atomic seconds since the Unix epoch, suitable for feeding to some of the
-CDateTime constructors.
+Returns the current POSIX time. Use the Cnow function for an
+epoch-agnostic measure of atomic seconds (i.e., an CInstant).
 
 =head1 CDateTime
 
 A CDateTime object describes the time as it would appear on someone's
-calendar and someone's clock. You can create a CDateTime object from
-the CInstant returned by the Ctime function:
+calendar and someone's clock. You can create a CDateTime object from an
+CInstant or from any object that does the CNumeric role; in the latter
+case, the argument is interpreted as POSIX time.
 
-my $now = DateTime.from-epoch(time);
+my $now = DateTime.new(now);
+my $now = DateTime.new(time); # same thing
 
-This is such a common use case, that there's a CDateTime.now
-constructor that does this for you:
+Or you can use named arguments:
 
-my $now = DateTime.now();
-
-General dates can be specified through the Cnew constructor:
-
 my $moonlanding = DateTime.new( :year(1969), :month(7), :day(16),
 :hour(20), :minute(17) ); # UTC time
 
-The full list of named arguments is as follows:
+This form allows the following arguments:
 
 :year   required
 :month  defaults to 1   range 1..12
@@ -80,25 +81,34 @@
 :hour   defaults to 0   range 0..23
 :minute defaults to 0   range 0..59
 :second defaults to 0   range 0.0..^62.0
-:timezone   defaults to '+' (UTC)
-:formatter  defaults to an iso8601 formatter, see below
 
-Another multi exists with CDate :date
-instead of C:year, C:month and C:day (and the same defaults as listed
-above).
+Another multi exists with CDate :date instead of C:year, C:month and
+C:day (and the same defaults as listed above).
 
-A shorter way to send in date and time information to is providing a
-single string with a full ISO8601 date and time. The example from above
+All four of the aforementioned forms of Cnew accept two additional named
+arguments. C:formatter is a callable object that takes a CDateTime and
+returns a string. The default formatter creates an ISO 8601 timestamp (see
+below). C:timezone is a callable object that takes a CDateTime and
+returns a two-element list giving the difference from UTC in (possibly both
+negative, but not of opposite signs) hours and minutes. Alternatively,
+C:timezone can be a two-element CSeq, which is interpreted as a static
+offset from UTC. The default time zone is C(0, 0) (i.e., UTC).
+
+A shorter way to send in date and time information is to provide a
+single string with a full ISO 8601 date and time. The example from above
 would then be
 
 my $moonlanding = DateTime.new( '1969-07-16T20:17:00Z' ); # UTC time
 
-The general form is C[date]T[time][offset], with [date] given
-as C-MM-DD and [time] given as Chh:mm:ss.
+The general form is C[date]T[time][offset], with [date] given as
+C-MM-DD and [time] given as Chh:mm:ss. The final CZ is a short
+form for C+, meaning UTC. (Note that while this form of Cnew
+accepts all of C+, C-, and CZ, the default formatter for
+CDateTime always expresses UTC as CZ.) The general notation for the C
+offset  is C+hhmm or C-hhmm. As before, a C:formatter argument is
+permitted. The C:timezone, if not supplied, is assumed to be a static
+offset equal to the offset in the given timestamp.
 
-The final CZ is a short form for C+, meaning UTC time. The
-general notation for the C offset  is C+hhmm or C-hhmm.
-
 With all the above constructors, if you attempt to pass in values that
 are outside of the ranges specified in the list above, you'll get an
 exception.  An exception will also be thrown if the particular day
@@ -107,12 +117,19 @@
 done against leap seconds. This class also explicitly does not check
 against ambiguous or invalid local times caused by Daylight Saving Time.
 
+There's one additional 

r31600 -[S32/Temporal] Prose edit; CSeq - list

2010-07-09 Thread pugs-commits
Author: Kodi
Date: 2010-07-09 21:47:34 +0200 (Fri, 09 Jul 2010)
New Revision: 31600

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32/Temporal] Prose edit; CSeq - list

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-09 19:09:30 UTC 
(rev 31599)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-09 19:47:34 UTC 
(rev 31600)
@@ -51,7 +51,7 @@
 Note that in this document, the term POSIX time means the number of
 seconds since midnight UTC of 1 January 1970, not counting leap seconds.
 This is the same as the output of the ISO C Ctime function except that it
-includes a fractional part.
+also includes a fractional part.
 
 =head1 Ctime
 
@@ -91,7 +91,7 @@
 below). C:timezone is a callable object that takes a CDateTime and
 returns a two-element list giving the difference from UTC in (possibly both
 negative, but not of opposite signs) hours and minutes. Alternatively,
-C:timezone can be a two-element CSeq, which is interpreted as a static
+C:timezone can be a two-element list, which is interpreted as a static
 offset from UTC. The default time zone is C(0, 0) (i.e., UTC).
 
 A shorter way to send in date and time information is to provide a



r31601 -[S04] simplify definition of successful return to be context agnostic

2010-07-09 Thread pugs-commits
Author: lwall
Date: 2010-07-09 23:10:45 +0200 (Fri, 09 Jul 2010)
New Revision: 31601

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
[S04] simplify definition of successful return to be context agnostic
define class-level PRE/POST to be submethods that are called like BUILD/DESTROY


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2010-07-09 19:47:34 UTC (rev 31600)
+++ docs/Perl6/Spec/S04-control.pod 2010-07-09 21:10:45 UTC (rev 31601)
@@ -13,8 +13,8 @@
 
 Created: 19 Aug 2004
 
-Last Modified: 27 Apr 2010
-Version: 98
+Last Modified: 9 Jul 2010
+Version: 99
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -1342,7 +1342,8 @@
 their side effects.  CPRE and CPOST must return boolean values that are
 evaluated according to the usual Design by Contract (DBC) rules.  (Plus,
 if you use CENTER/CLEAVE in a class block, they only execute when the
-class block is executed, but CPRE/CPOST in a class block are evaluated
+class block is executed, but you may declare CPRE/CPOST submethods
+in a class block that will be evaluated
 around every method in the class.)  CKEEP and CUNDO are just variants
 of CLEAVE, and for execution order are treated as part of the queue of
 CLEAVE phasers.
@@ -1376,8 +1377,19 @@
 everything else, to guarantee that even CLEAVE phasers can't violate DBC.
 Likewise CPRE phasers fire off before any CENTER or CFIRST (though not
 before CBEGIN, CCHECK, or CINIT, since those are done at compile or
-process initialization time).
+process initialization time).  Much like CBUILD and CDESTROY are implicitly
+called in the correct order by CBUILDALL and CDESTROYALL, the 
CPRE/CPOST
+calls are via an implicit CENFORCEALL method that runs
+outside the actual call to the method in question.  Class-level CPRE/CPOST
+submethods are notionally outside of the method-level CPRE/CPOST blocks.
+At each submethod level, CENFORCEALL calls (in the normal course of things):
 
+1. class's CPRE submethod
+2. method's CPRE phaser
+3. method call
+4. method's CPOST phaser
+5. class's CPOST submethod
+
 If exit phasers are running as a result of a stack unwind initiated
 by an exception, C$! contains the exception that caused it, though
 it will be marked as handled by then.  In any case, the information
@@ -1404,11 +1416,15 @@
 world in raw form, so that the phaser doesn't accidentally impose
 context prematurely.)
 
-The topic of the outer block is still available as C OUTER::$_ .
+The topic of the outer block of a phaser is still available as C OUTER::$_ 
.
 Whether the return value is modifiable may be a policy of the phaser
 in question.  In particular, the return value should not be modified
 within a CPOST phaser, but a CLEAVE phaser could be more liberal.
 
+Class-level CPRE and CPOST submethods are not in the lexical
+scope of a method, and are not run in the dynamic scope of the method,
+so cannot see the method's C$_ at all.
+
 =head1 Statement parsing
 
 In this statement:
@@ -1578,14 +1594,7 @@
 is okay.
 
 In the absence of error exception propagation, a successful exit is one that
-returns a defined value in item context, or any number of values
-in list context as long as the length is defined.  (A length of +Inf
-is considered a defined length.  A length of 0 is also a defined length,
-which means it's a successful return even though the list would evaluate
-to false in a boolean context.)  A list can have a defined length
-even if it contains undefined scalar values.  A list is of undefined
-length only if it contains an undefined generator, which, happily, is
-what is returned by the Cfail function when used in list context.
+returns a defined value or parcel.  (A defined parcel may contain undefined 
values.)
 So any Perl 6 function can say
 
 fail message;



r31609 -[S04,6] more refinement of how scoping works under DBC

2010-07-09 Thread pugs-commits
Author: lwall
Date: 2010-07-10 00:55:41 +0200 (Sat, 10 Jul 2010)
New Revision: 31609

Modified:
   docs/Perl6/Spec/S04-control.pod
   docs/Perl6/Spec/S06-routines.pod
Log:
[S04,6] more refinement of how scoping works under DBC
note that all phasers in methods to have access to self via closure


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2010-07-09 22:39:12 UTC (rev 31608)
+++ docs/Perl6/Spec/S04-control.pod 2010-07-09 22:55:41 UTC (rev 31609)
@@ -14,7 +14,7 @@
 Created: 19 Aug 2004
 
 Last Modified: 9 Jul 2010
-Version: 99
+Version: 100
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -1379,17 +1379,31 @@
 before CBEGIN, CCHECK, or CINIT, since those are done at compile or
 process initialization time).  Much like CBUILD and CDESTROY are implicitly
 called in the correct order by CBUILDALL and CDESTROYALL, the 
CPRE/CPOST
-calls are via an implicit CENFORCEALL method that runs
+calls are via an implicit CCALL-VIA-DBC method that runs
 outside the actual call to the method in question.  Class-level CPRE/CPOST
 submethods are notionally outside of the method-level CPRE/CPOST blocks.
-At each submethod level, CENFORCEALL calls (in the normal course of things):
+In the normal course of things, CCALL-VIA-DBC follows these steps:
 
-1. class's CPRE submethod
-2. method's CPRE phaser
-3. method call
-4. method's CPOST phaser
-5. class's CPOST submethod
+1. create an empty stack for scheduling postcalls.
+2. call all the appropriate per-class CPRE submethods,
+pushing any corresponding CPOST onto the postcall stack.
+3. call all the appropriate per-method CPRE phasers,
+pushing any corresponding CPOST onto the postcall stack.
+4. enforce DBC logic of CPRE calls
+5. call the method call itself, capturing return/unwind status.
+6. pop and call every CPOST on the postcall stack.
+7. enforce DBC logic of CPOST calls
+8. continue with the return or unwind.
 
+Note that in steps 2 and 3, the CPOST block can be defined in
+one of two ways.  Either the corresponding CPOST is defined as a
+separate declaration (submethod for 2, phaser for 3), in which case
+CPRE and CPOST share no lexical scope.  Alternately, any CPRE
+(either submethod or phaser) may define its corresponding CPOST
+as an embedded phaser block that closes over the lexical scope of
+the CPRE.  In either case, the code is pushed onto the postphaser
+stack to be run at the appropriate moment.
+
 If exit phasers are running as a result of a stack unwind initiated
 by an exception, C$! contains the exception that caused it, though
 it will be marked as handled by then.  In any case, the information
@@ -1416,15 +1430,22 @@
 world in raw form, so that the phaser doesn't accidentally impose
 context prematurely.)
 
-The topic of the outer block of a phaser is still available as C OUTER::$_ 
.
+The topic of the block outside a phaser is still available as C OUTER::$_ 
.
 Whether the return value is modifiable may be a policy of the phaser
 in question.  In particular, the return value should not be modified
 within a CPOST phaser, but a CLEAVE phaser could be more liberal.
 
-Class-level CPRE and CPOST submethods are not in the lexical
-scope of a method, and are not run in the dynamic scope of the method,
-so cannot see the method's C$_ at all.
+Class-level CPRE and CPOST submethods are not in the lexical scope
+of a method (and are not run in the dynamic scope of the method),
+so they cannot see the method's C$_ at all.  As methods, they
+do have access to the current Cself, of course.  And the CPOST
+submethod gets the return value as the topic, just as exit phasers do.
 
+Any phaser defined in the lexical scope of a method is a closure that
+closes over Cself as well as normal lexicals.  (Or equivalently,
+an implementation may simply turn all such phasers into submethods
+whose curried invocant is the current object.)
+
 =head1 Statement parsing
 
 In this statement:

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-09 22:39:12 UTC (rev 31608)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-09 22:55:41 UTC (rev 31609)
@@ -17,7 +17,7 @@
 Created: 21 Mar 2003
 
 Last Modified: 9 Jul 2010
-Version: 137
+Version: 138
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -2093,7 +2093,8 @@
 or CENTER block are automatically hoisted outward to be called at the
 same time as other CPOST phasers.  This conveniently gives circum
 semantics by virtue of wrapping the post lexical scope within the pre
-lexical scope.
+lexical scope.  That is, the CPOST closes over its outer scope, even
+if that scope is gone by the time the CPOST is run.
 
 method push 

r31610 -[S04] emphasize that LEAVE blocks *always* run even under stack unwinding

2010-07-09 Thread pugs-commits
Author: lwall
Date: 2010-07-10 00:59:12 +0200 (Sat, 10 Jul 2010)
New Revision: 31610

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
[S04] emphasize that LEAVE blocks *always* run even under stack unwinding


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2010-07-09 22:55:41 UTC (rev 31609)
+++ docs/Perl6/Spec/S04-control.pod 2010-07-09 22:59:12 UTC (rev 31610)
@@ -1230,7 +1230,7 @@
   START {...}*  on first ever execution, once per closure clone
 
   ENTER {...}*  at every block entry time, repeats on loop blocks.
-  LEAVE {...}   at every block exit time
+  LEAVE {...}   at every block exit time (even stack unwinds from 
exceptions)
KEEP {...}   at every successful block exit, part of LEAVE queue
UNDO {...}   at every unsuccessful block exit, part of LEAVE queue
 



r31582 -[Str] fix lines def to use .comb(/ ^^ \N* /) for masak++

2010-07-08 Thread pugs-commits
Author: lwall
Date: 2010-07-08 23:02:00 +0200 (Thu, 08 Jul 2010)
New Revision: 31582

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[Str] fix lines def to use .comb(/ ^^ \N* /) for masak++


Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-08 19:04:55 UTC (rev 
31581)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-08 21:02:00 UTC (rev 
31582)
@@ -407,7 +407,7 @@
  our List multi method lines ( Str $input: Int $limit = Inf ) is export
 
 Returns a list of lines, i.e. the same as a call to
-C$input.comb( / \N*\n | \N+$ /, $limit ) would.
+C$input.comb( / ^^ \N* /, $limit ) would.
 
 =item words
 



r31583 -[S06] define a * statement to represent a call from a proto to its multis

2010-07-08 Thread pugs-commits
Author: lwall
Date: 2010-07-08 23:04:28 +0200 (Thu, 08 Jul 2010)
New Revision: 31583

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] define a * statement to represent a call from a proto to its multis


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-07-08 21:02:00 UTC (rev 31582)
+++ docs/Perl6/Spec/S06-routines.pod2010-07-08 21:04:28 UTC (rev 31583)
@@ -16,8 +16,8 @@
 
 Created: 21 Mar 2003
 
-Last Modified: 18 Jun 2010
-Version: 135
+Last Modified: 8 Jul 2010
+Version: 136
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -99,11 +99,24 @@
 and dispatches them according to the rules of multiple dispatch as defined
 for each of the various dispatchers.
 
-This default behavior is implied by an empty body on the proto.  It may
-be overridden with an explicit proto body.  The default dispatcher may be
-called from within the body using 'nextsame'.  (That is, an empty body C{}
-is equivalent to C{nextsame;}.)
+This default behavior is implied by a statement consisting of a single
+C* (that is, a whatever).  Hence the typical proto will simply
+have a body of C{*}.
 
+proto method bar {*}
+
+(We don't use C... for that because it would fail at run time,
+and proto blocks are not stubs, but are intended to be executed.)
+
+Other statements may be inserted before and after the C*
+statement to capture control before or after the multi dispatch:
+
+proto foo ($a,$b) { say Called with $a $b; *; say Returning; }
+
+(That proto is only good for multis with side effects and no return
+value, since it returns the result of Csay, which might not be what
+you want.  See below for how to fix that.)
+
 The syntactic form Cfoo (without a modifying signature) can never refer to
 a multi candidate.  It may only refer to the single Conly or Cproto routine
 that would first be called by Cfoo().  Individual multis may be named by
@@ -135,10 +148,29 @@
 
 my proto sub foo () {
 do-something-before();
-callsame;   # call into the managed set, then come back
+my |$cap = (*);   # call into the managed set, then come back
 do-something-after();
+return |$cap;
 }
 
+or more simply:
+
+my proto sub foo () {
+ENTER do-something-before();
+*; 
+LEAVE do-something-after();
+}
+
+Note that in the first example the C* must be placed into a
+context where it is a standalone statement in order to get its
+return value.
+
+Another common variant would be to propagate control to the
+outer/higher routine that would have been found if this one didn't
+exist:
+
+my proto method foo { *; UNDO nextsame; }  # failover to super foo
+
 Note that, in addition to making multis work similarly to each other,
 the new proto semantics greatly simplify top-level dispatchers, which
 never have to worry about multis, because multis are always in the



r31584 -[S05] also define how * does multi dispatch inside regexes

2010-07-08 Thread pugs-commits
Author: lwall
Date: 2010-07-09 02:13:08 +0200 (Fri, 09 Jul 2010)
New Revision: 31584

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] also define how * does multi dispatch inside regexes
delete ... et al. since they're redundant with {...}


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-07-08 21:04:28 UTC (rev 31583)
+++ docs/Perl6/Spec/S05-regex.pod   2010-07-09 00:13:08 UTC (rev 31584)
@@ -16,8 +16,8 @@
 
 Created: 24 Jun 2002
 
-Last Modified: 11 Jun 2010
-Version: 125
+Last Modified: 8 Jul 2010
+Version: 126
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them Iregex rather than regular
@@ -1127,7 +1127,7 @@
 match.  The symbol is specified as part of the long name.  It may also
 be matched within the rule using C sym , like this:
 
-proto token sigil { }
+proto token sigil {*}
 multi token sigil:sym$  { sym }
 multi token sigil:sym@  { sym }
 multi token sigil:sym%  { sym }
@@ -1147,6 +1147,13 @@
 tie, a normal multiple dispatch is made using the arguments to the
 remaining variants, assuming they can be differentiated by type.
 
+The proto calls into the subdispatcher when it sees a C* that
+cannot be a quantifier and is the only thing in its bracket.  Therefore
+you can put items before and after the subdispatch by putting
+the C* into square brackets:
+
+proto token foo { prestuff [*] poststuff }
+
 =item *
 
 The use of a hash variable in patterns is reserved.
@@ -1574,15 +1581,6 @@
 
 =item *
 
-The C ... , C ??? , and C !!!  special tokens
-have the same not-defined-yet meanings within regexes that the bare
-elipses have in ordinary code.  (However, by the recursive rules above,
-C !!  is equivalent to C ? , which matches the null string.
-Likewise C !!before x  is just like C ?before x , except
-that it is ignored by the longest-token matcher.)
-
-=item *
-
 A leading C* indicates that the following pattern allows a
 partial match.  It always succeeds after matching as many characters
 as possible.  (It is not zero-width unless 0 characters match.)



r31569 -[IO,Str] regularize .lines to be more like .words when fed a string

2010-07-07 Thread pugs-commits
Author: lwall
Date: 2010-07-08 00:13:41 +0200 (Thu, 08 Jul 2010)
New Revision: 31569

Modified:
   docs/Perl6/Spec/S32-setting-library/IO.pod
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[IO,Str] regularize .lines to be more like .words when fed a string
.lines will no longer interpret a string as a filename


Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===
--- docs/Perl6/Spec/S32-setting-library/IO.pod  2010-07-07 21:04:26 UTC (rev 
31568)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod  2010-07-07 22:13:41 UTC (rev 
31569)
@@ -892,14 +892,7 @@
 -- List
 )
 
-multi lines (Str $filename,
-Any  $limit = *,
-Bool :$bin = False,
-Str  :$enc = Unicode,
-Any  :$nl = \n,
-Bool :$chomp = True,
--- List
-)
+# See also Str.lines and lines(Str)
 
 Returns some or all the lines of a file or entries in a directory
 as a CList regardless of context.

Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 21:04:26 UTC (rev 
31568)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 22:13:41 UTC (rev 
31569)
@@ -402,6 +402,14 @@
 function is combing a lazy structure, the return values may also be
 lazy.  (Strings are not lazy, however.)
 
+=item lines
+
+ our List multi lines ( Str $input, Int $limit = * )
+ our List multi method lines ( Str $input: Int $limit = * )
+
+Returns a list of lines, i.e. the same as a call to
+C$input.comb( / \N*\n | \N+$ /, $limit ) would.
+
 =item words
 
  our List multi words ( Str $input, Int $limit = * )



r31570 -[S32/Str] saved a few words and lines with is export

2010-07-07 Thread pugs-commits
Author: masak
Date: 2010-07-08 00:19:08 +0200 (Thu, 08 Jul 2010)
New Revision: 31570

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] saved a few words and lines with is export

Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 22:13:41 UTC (rev 
31569)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 22:19:08 UTC (rev 
31570)
@@ -404,16 +404,14 @@
 
 =item lines
 
- our List multi lines ( Str $input, Int $limit = * )
- our List multi method lines ( Str $input: Int $limit = * )
+ our List multi method lines ( Str $input: Int $limit = * ) is export
 
 Returns a list of lines, i.e. the same as a call to
 C$input.comb( / \N*\n | \N+$ /, $limit ) would.
 
 =item words
 
- our List multi words ( Str $input, Int $limit = * )
- our List multi method words ( Str $input: Int $limit = * )
+ our List multi method words ( Str $input: Int $limit = * ) is export
 
 Returns a list of non-whitespace bits, i.e. the same as a call to
 C$input.comb( / \S+ /, $limit ) would.



r31571 -[S32] Dropped mention of quarters from Temporal.pod. I don't think quarter-numbering belongs in the core, since (as far as I know) there is no precise standard way of dividing calendar years i

2010-07-07 Thread pugs-commits
Author: Kodi
Date: 2010-07-08 01:42:53 +0200 (Thu, 08 Jul 2010)
New Revision: 31571

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
   t/spec/S32-temporal/DateTime.t
Log:
[S32] Dropped mention of quarters from Temporal.pod. I don't think 
quarter-numbering belongs in the core, since (as far as I know) there is no 
precise standard way of dividing calendar years into four.

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-07 22:19:08 UTC 
(rev 31570)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-07-07 23:42:53 UTC 
(rev 31571)
@@ -128,9 +128,6 @@
 month, the day itself included. For example, June 9, 2003 is the second
 Monday of the month, and so this method returns 2 for that day.
 
-The Cquarter method returns the quarter of the year, a value between 1
-and 4. The Cday-of-quarter method returns the day of the quarter.
-
 The Cday-of-year method returns the day of the year, a value between 1
 and 366.
 

Modified: t/spec/S32-temporal/DateTime.t
===
--- t/spec/S32-temporal/DateTime.t  2010-07-07 22:19:08 UTC (rev 31570)
+++ t/spec/S32-temporal/DateTime.t  2010-07-07 23:42:53 UTC (rev 31571)
@@ -1,8 +1,10 @@
 use v6;
 use Test;
 
+use Temporal; use Date; # XXX
+
 plan *;
-
+#`⁅
 my ( DateTime $g1, DateTime $g2, Num $t, Int $d );
 
 $g1 = DateTime.from-epoch(0);
@@ -132,17 +134,17 @@
 is $date.month, 6, 'Date month'; # test 23
 is $date.day, 4, 'Date day'; # test 24
 
-# ---
-
+# 
+#`⁆
 sub dt { DateTime.new(year = 1984, |%_); }
 sub ds (Str $s) { DateTime.new($s) }
 sub ymd ($y, $m, $d) { DateTime.new(year = $y, month = $m, day = $d); }
 
 my $now = DateTime.now;
-
-# ---
+#`⁅
+# 
 # Input validation
-# ---
+# 
 
 # LS32::Temporal/'CDateTime'/outside of the ranges specified
 
@@ -197,9 +199,9 @@
 lives_ok { $now.set(second = 61.5) }, 'DateTime accepts second 61.5 (.set)';
 dies_ok { $now.set(second = 62) }, 'DateTime rejects second 62 (.set)';
 
-# ---
+# 
 # LS32::Temporal/'Get methods'/'The method Cwhole-second'
-# ---
+# 
 
 is dt(second = 22).whole-second, 22, 'DateTime.whole-second (22)';
 is dt(second = 22.1).whole-second, 22, 'DateTime.whole-second (22.1)';
@@ -209,9 +211,9 @@
 is dt(second = 60).whole-second, 60, 'DateTime.whole-second (60)';
 is dt(second = 60.5).whole-second, 60, 'DateTime.whole-second (60.5)';
 
-# ---
+# 
 # LS32::Temporal/'Get methods'/'The method Cweek'
-# ---
+# 
 
 is ymd(1977, 8, 20).week.join(' '), '1977 33', 'DateTime.week (1977-8-20)';
 is ymd(1977, 8, 20).week-year, 1977, 'DateTime.week (1977-8-20)';
@@ -238,14 +240,121 @@
 is ymd(2010, 01, 03).week-year, 2009, 'DateTime.week-year (2010-01-03)';
 is ymd(2010, 01, 03).week-number, 53, 'DateTime.week-number (2010-01-03)';
 
-# ---
+# 
 # LS32::Temporal/'Get methods'/also $dt.date('-')
-# ---
+# 
 
 is $now.date, $now.ymd, 'DateTime.ymd can be spelled as DateTime.date';
 is $now.time, $now.hms, 'DateTime.hms can be spelled as DateTime.time';
 
+# 
+# LS32::Temporal/'Set methods'/'The Ctruncate method'
+# 
+
+{
+my $moon-landing = dt# Although the seconds part is fictional.
+   year = 1969, month = 6, day = 20,
+   hour = 8, minute = 17, second = 32.4;
+
+my $dt = $moon-landing.clone; $dt.truncate(to = 'second');
+is $dt.second, 32, 'DateTime.truncate(to = second)';
+$dt = $moon-landing.clone; $dt.truncate(to = 'minute');
+is $dt.iso8601, '1969-06-20T08:17:00+', 'DateTime.truncate(to = 
minute)';
+$dt = $moon-landing.clone; $dt.truncate(to = 'hour');
+is $dt.iso8601, 

r31573 -[Str] limits should default to Inf rather than * since that is (supposedly) compatible with Int

2010-07-07 Thread pugs-commits
Author: lwall
Date: 2010-07-08 03:37:15 +0200 (Thu, 08 Jul 2010)
New Revision: 31573

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[Str] limits should default to Inf rather than * since that is (supposedly) 
compatible with Int


Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-07 23:45:31 UTC (rev 
31572)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-07-08 01:37:15 UTC (rev 
31573)
@@ -339,10 +339,10 @@
 =item split
 Xsplit
 
- our List multi split ( Str $delimiter, Str $input, Int $limit = * )
- our List multi split ( Regex $delimiter, Str $input, Int $limit = * )
- our List multi method split ( Str $input: Str $delimiter, Int $limit = * )
- our List multi method split ( Str $input: Regex $delimiter, Int $limit = *, 
Bool :$all = False)
+ our List multi split ( Str $delimiter, Str $input, Int $limit = Inf )
+ our List multi split ( Regex $delimiter, Str $input, Int $limit = Inf )
+ our List multi method split ( Str $input: Str $delimiter, Int $limit = Inf )
+ our List multi method split ( Str $input: Regex $delimiter, Int $limit = Inf, 
Bool :$all = False)
 
 Splits a string up into pieces based on delimiters found in the string.
 
@@ -371,8 +371,8 @@
 
 =item comb
 
- our List multi comb ( Regex $matcher, Str $input, Int $limit = * )
- our List multi method comb ( Str $input: Regex $matcher = /./, Int $limit = * 
)
+ our List multi comb ( Regex $matcher, Str $input, Int $limit = Inf )
+ our List multi method comb ( Str $input: Regex $matcher = /./, Int $limit = 
Inf )
 
 The Ccomb function looks through a string for the interesting bits,
 ignoring the parts that don't match.  In other words, it's a version
@@ -404,14 +404,14 @@
 
 =item lines
 
- our List multi method lines ( Str $input: Int $limit = * ) is export
+ our List multi method lines ( Str $input: Int $limit = Inf ) is export
 
 Returns a list of lines, i.e. the same as a call to
 C$input.comb( / \N*\n | \N+$ /, $limit ) would.
 
 =item words
 
- our List multi method words ( Str $input: Int $limit = * ) is export
+ our List multi method words ( Str $input: Int $limit = Inf ) is export
 
 Returns a list of non-whitespace bits, i.e. the same as a call to
 C$input.comb( / \S+ /, $limit ) would.



r31543 -[S32/IO] changed API for C.read and C.write

2010-07-04 Thread pugs-commits
Author: masak
Date: 2010-07-04 15:05:13 +0200 (Sun, 04 Jul 2010)
New Revision: 31543

Modified:
   docs/Perl6/Spec/S32-setting-library/IO.pod
Log:
[S32/IO] changed API for C.read and C.write

The API looked unnatural and non-Perly, so I changed it to something that made
sense. Rather than sending in an Int to indicate how much to write, just let
the length of the Buf determine that. (If you want to send a prefix of a Buf,
just make a slice -- a more general operation.)

Similarly, rather than having to send in an existing Buf for overwriting in
the read method, just return a new Buf. Don't need to return an Int; if we
are truly interested in the number of bytes read, we can do $buf.elems.

Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===
--- docs/Perl6/Spec/S32-setting-library/IO.pod  2010-07-04 11:18:26 UTC (rev 
31542)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod  2010-07-04 13:05:13 UTC (rev 
31543)
@@ -22,8 +22,8 @@
 
 Created: 19 Feb 2009 extracted from S29-functions.pod; added stuff from 
S16-IO later
 
-Last Modified: 30 May 2010
-Version: 12
+Last Modified: 4 July 2010
+Version: 13
 
 The document is a draft.
 
@@ -147,7 +147,7 @@
 
 role IO::Readable {
 has $.isReadable;
-method read($buf is rw, Int $bytes -- Int)
+method read(Int $bytes -- Buf)
 }
 
 When the C$.isReadable is set, it tries to change the readability of the 
filehandle.  This
@@ -156,16 +156,14 @@
 
 =over
 
-=item method read($buf is rw, Int $bytes -- Int)
+=item method read(Int $bytes -- Buf)
 
-Tries to read C$bytes bytes and store in C$buf. The contents of C$buf
-are replaced and the actual number of bytes read is returned. A return
-of 0 means end of file. It might return unthrown failures, to be
-specified by each CIO implementation.
+Tries to read C$bytes bytes and return it as a CBuf. The CBuf may be
+shorter than the actual specified number of C$bytes.
 
-It is important to realize that this is raw read. You're going to
-have plain octets stored in C$buf, if this is actually encoded data,
-you're going to need to encode it later, or use getc or other
+This is raw read. You're going to
+have plain octets stored in C$buf. If what you want is a CStr,
+you're going to need to C.decode it after Creading, or use getc or other
 CIO::Readable::Encoded methods.
 
 =back
@@ -176,7 +174,7 @@
 
 role IO::Writeable {
 has $.isWriteable;
-method write($buf, Int $bytes -- Int)
+method write(Buf $buf -- Int)
 }
 
 When the C$.isWriteable is set, it tries to change the writeability of the 
filehandle.
@@ -185,15 +183,14 @@
 
 =over
 
-=item method write($buf, Int $bytes -- Int)
+=item method write(Buf $buf -- Int)
 
-Tries to write C$bytes bytes of C$buf. The actual number of bytes
+Tries to write C$buf. The actual number of bytes
 written is returned. It might return unthrown failures, to be
 specified by each CIO implementation.
 
-It is important to realize that this is raw write. C$buf should
-contain plain octets that are going to be sent. If C$buf contains
-encoded data, you should decode it first, or use print or other
+This is raw write. C$buf contains plain octets. If you want to Cwrite
+a CStr, you should C.encode it first, or use print or other
 CIO::Writeable::Encoded methods.
 
 =back



r31533 -[S12] Clarify phasing of lexical classes

2010-07-03 Thread pugs-commits
Author: sorear
Date: 2010-07-03 11:14:27 +0200 (Sat, 03 Jul 2010)
New Revision: 31533

Modified:
   docs/Perl6/Spec/S12-objects.pod
Log:
[S12] Clarify phasing of lexical classes


Modified: docs/Perl6/Spec/S12-objects.pod
===
--- docs/Perl6/Spec/S12-objects.pod 2010-07-03 04:39:32 UTC (rev 31532)
+++ docs/Perl6/Spec/S12-objects.pod 2010-07-03 09:14:27 UTC (rev 31533)
@@ -184,6 +184,15 @@
 is lexical by default also means that any names your class imports
 are also private by default.
 
+Class declarations (in particular, role composition) are strictly
+compile time statements.  In particular, if a class declaration appears
+inside a nested scope, the class declaration is constrained to compose
+in exactly the same way on any possible execution.  All named roles and
+superclasses must be bound as non-rebindable readonly values; any
+parameters to traits will be evaluated only in a non-cloning context.
+Names bound by the class declaration are made non-rebindable and read
+only so they may be used as superclasses.
+
 In an anonymous class declaration, C:: by itself may represent the
 anonymous class name if desired:
 



r31532 -[S04] Clarify interaction of lexical classes and packages with members after discussion with TimToady

2010-07-02 Thread pugs-commits
Author: sorear
Date: 2010-07-03 06:39:32 +0200 (Sat, 03 Jul 2010)
New Revision: 31532

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
[S04] Clarify interaction of lexical classes and packages with members after 
discussion with TimToady


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2010-07-02 23:37:35 UTC (rev 31531)
+++ docs/Perl6/Spec/S04-control.pod 2010-07-03 04:39:32 UTC (rev 31532)
@@ -1625,7 +1625,7 @@
 no guarantee can be made that the scope needed for cloning will
 remain in existence over the life of the reference.)
 
-In particular, named subroutines are a special problem when embedded in
+In particular, package subroutines are a special problem when embedded in
 a changing lexical scope (when they make reference to it).  The binding
 of such a definition to a name within a symbol table counts as taking
 a reference, so at compile time there is an initial binding
@@ -1642,6 +1642,21 @@
 take into consideration that it is functioning only as a cache of the
 most recent cloning, not as a surrogate for the current lexical scope.)
 
+Matters are more complicated if the package in question is lexically defined.
+In such cases, the package must be cloned as if it were a sub on entry to the
+corresponding lexical scope.  All runtime instances of a single package
+declaration share the same set of compile-time declared functions, however,
+the runtime instances can have different lexical environments as described in
+the preceding paragraph.  If multiple conflicting definitons of a sub exist
+for the same compile-time package, an error condition exists and behavior is
+not specified for Perl 6.0.
+
+Methods in classes behave functionally like package subroutines, and have the
+same binding behavior if the classes are cloned.  Note that a class 
declaration,
+even an augment, is fundamentally a compile-time operation; composition only
+happens once and the results are recorded in the prototype class.  Runtime
+typological manipulations are limited to reseating COUTER:: scopes of 
methods.
+
 Lexical names do not share this problem, since the symbol goes out
 of scope synchronously with its usage.  Unlike global subs, they
 do not need a compile-time binding, but like global subs,



r31505 -[Spec] Clarify when to return Nil from the series operator.

2010-06-29 Thread pugs-commits
Author: colomon
Date: 2010-06-29 20:49:47 +0200 (Tue, 29 Jun 2010)
New Revision: 31505

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[Spec] Clarify when to return Nil from the series operator.

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-06-29 14:14:07 UTC (rev 31504)
+++ docs/Perl6/Spec/S03-operators.pod   2010-06-29 18:49:47 UTC (rev 31505)
@@ -1950,8 +1950,8 @@
 For intuited numeric generators that don't involve geometric sign changes, all
 values are assumed to be monotonically increasing or decreasing, as determined
 by the (up to) three values used above; if a supplied limit value is on the
-wrong side of the first of those values, Nil is returned, even though the
-limit value never matches, and never falls between two generated values.
+wrong side of the first value of the full left list, Nil is returned, even
+though the limit value never matches, and never falls between two generated 
values.
 Examples:
 
 my $n = 0;



r31490 -[S06] \| and | prefixes of parameters should be separately introspectable

2010-06-28 Thread pugs-commits
Author: moritz
Date: 2010-06-28 22:59:28 +0200 (Mon, 28 Jun 2010)
New Revision: 31490

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] \| and | prefixes of parameters should be separately introspectable

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-06-28 20:59:24 UTC (rev 31489)
+++ docs/Perl6/Spec/S06-routines.pod2010-06-28 20:59:28 UTC (rev 31490)
@@ -2174,6 +2174,7 @@
   copy   True if the parameter has Cis copy trait
   named  True if the parameter is to be passed named
   named_namesList of names a named parameter can be passed as
+  captureTrue if the paramater binds the caller's Capture
   parcel True if the parameter is too lazy to contextualize
   slurpy True if the parameter is slurpy
   optional   True if the parameter is optional



r31454 -[S03] change !% to %% to avoid metaconfusion

2010-06-26 Thread pugs-commits
Author: lwall
Date: 2010-06-26 19:46:00 +0200 (Sat, 26 Jun 2010)
New Revision: 31454

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] change !% to %% to avoid metaconfusion


Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-06-26 17:43:10 UTC (rev 31453)
+++ docs/Perl6/Spec/S03-operators.pod   2010-06-26 17:46:00 UTC (rev 31454)
@@ -15,8 +15,8 @@
 
 Created: 8 Mar 2004
 
-Last Modified: 24 Jun 2010
-Version: 211
+Last Modified: 26 Jun 2010
+Version: 212
 
 =head1 Overview
 
@@ -36,7 +36,7 @@
 N  Autoincrement ++ --
 R  Exponentiation**
 L  Symbolic unary! + - ~ ? | || +^ ~^ ?^ ^
-L  Multiplicative* / % + + + ~ ~ ~ ? div mod
+L  Multiplicative* / % %% + + + ~ ~ ~ ? div mod
 L  Additive  + - +| +^ ~| ~^ ?| ?^
 L  Replication   x xx
 X  Concatenation ~
@@ -783,6 +783,18 @@
 
 =item *
 
+C infix:%% , is divisible by
+
+$x %% $y
+
+Performs a C% and then tests the result for 0, returning CBool::True if
+the C$x is evenly divisible by C$y, and CBool::False otherwise.
+
+You may use C!%% to mean not divisible by, though C% itself generally
+has the same effect.
+
+=item *
+
 C infix:mod , integer modulo
 
 $x mod $y
@@ -3962,13 +3974,8 @@
 
 The precedence of any negated operator is the same as the base operator.
 
-The operator
-
-!%
-
-is specially allowed for testing even divisibility by an integer.
-
-Note that logical operators such as C|| and C^^ do not return a Bool,
+You may negate only those operators that return a CBool.  Note that
+logical operators such as C|| and C^^ do not return a CBool,
 but rather one of the operands.
 
 =head2 Reversed operators



r31442 -[S03] qualify misleading assertion re 1,2,3...$n when $n 3

2010-06-24 Thread pugs-commits
Author: lwall
Date: 2010-06-24 22:54:50 +0200 (Thu, 24 Jun 2010)
New Revision: 31442

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] qualify misleading assertion re 1,2,3...$n when $n  3


Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-06-24 20:49:06 UTC (rev 31441)
+++ docs/Perl6/Spec/S03-operators.pod   2010-06-24 20:54:50 UTC (rev 31442)
@@ -15,8 +15,8 @@
 
 Created: 8 Mar 2004
 
-Last Modified: 18 Jun 2010
-Version: 210
+Last Modified: 24 Jun 2010
+Version: 211
 
 =head1 Overview
 
@@ -1811,7 +1811,8 @@
 
 Once we know the limit of the series, the left list is evaluated item
 by item, and ordinary numeric or string values are passed through
-unchanged.  If any value in the series is Ceqv to the limit value,
+unchanged (to the extent allowed by the limit on the right).
+If any value in the series is Ceqv to the limit value,
 the series terminates, including that final limit value.  For any value
 after the first lefthand value, if that value and the previous value
 fall on opposite sides of the limit, the series terminates without



r31419 -[S03] Capitalo.

2010-06-23 Thread pugs-commits
Author: Kodi
Date: 2010-06-23 23:02:49 +0200 (Wed, 23 Jun 2010)
New Revision: 31419

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] Capitalo.

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-06-23 20:10:38 UTC (rev 31418)
+++ docs/Perl6/Spec/S03-operators.pod   2010-06-23 21:02:49 UTC (rev 31419)
@@ -1834,7 +1834,7 @@
 
 2, { $^a + 2 } ... *  # 2,4,6,8,10,12,14,16...
 
-Generating the fibonacci sequence takes two arguments at a time:
+Generating the Fibonacci sequence takes two arguments at a time:
 
 1, 1, { $^a + $^b } ... * # 1,1,2,3,5,8,13,21...
 



r31409 -[S29, S32] removed eqv() and cmp() functions

2010-06-22 Thread pugs-commits
Author: masak
Date: 2010-06-22 16:40:29 +0200 (Tue, 22 Jun 2010)
New Revision: 31409

Modified:
   docs/Perl6/Spec/S29-functions.pod
   docs/Perl6/Spec/S32-setting-library/Basics.pod
Log:
[S29, S32] removed eqv() and cmp() functions

They don't confer any particular advantages over the operator forms.
The support for their removal on #perl6 was overwhelming.

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2010-06-22 14:31:26 UTC (rev 31408)
+++ docs/Perl6/Spec/S29-functions.pod   2010-06-22 14:40:29 UTC (rev 31409)
@@ -138,16 +138,10 @@
  subset Ordering where Signature | KeyExtractor | Comparator | OrderingPair | 
Whatever;
 
 Used to handle comparisons between things.  Generally this
-ends up in functions like Ccmp(), Ceqv(), Csort(),
+ends up in functions like Csort(),
 Cmin(), Cmax(), etc., as a $by parameter which provides
 the information on how two things compare relative to each other.
 
-Note that Ceqv() and Ccmp() do almost but not the same thing
-since with Ceqv() you don't care if two things are ordered
-increasing or decreasing but only if they are the same or not.
-Rather than declare an CEquiving type declaration COrdering will
-just do double duty.
-
 =over
 
 =item Comparator

Modified: docs/Perl6/Spec/S32-setting-library/Basics.pod
===
--- docs/Perl6/Spec/S32-setting-library/Basics.pod  2010-06-22 14:31:26 UTC 
(rev 31408)
+++ docs/Perl6/Spec/S32-setting-library/Basics.pod  2010-06-22 14:40:29 UTC 
(rev 31409)
@@ -108,15 +108,9 @@
 The following are defined in the CAny role:
 
  role Any does Mu does Pattern {
- our Bool multi sub eqv (Ordering @by, $a, $b) {...}
- our Bool multi sub eqv (Ordering $by = infix:eqv, $a, $b) {...}
-
  our multi method clone (::T $self -- T) {...}
  our multi method clone (::T $self, *%attributes -- T) {...}
 
- our Order multi sub cmp (Ordering @by, $a, $b) {...}
- our Order multi sub cmp (Ordering $by = infix:cmp, $a, $b) {...}
-
  our Callable multi method can ($self:, Str $method) {...}
  our Bool multi method does ($self:, $type) {...}
  our Bool multi method isa  ($self:, $type) {...}
@@ -126,16 +120,6 @@
 
 =over
 
-=item eqv
-
- our Bool multi sub eqv (Ordering @by, $a, $b)
- our Bool multi sub eqv (Ordering $by = infix:eqv, $a, $b)
-
-Returns a Bool indicating if the parameters are equivalent,
-using criteria C$by or C@by for comparisons. C@by differs
-from C$by in that each criterion is applied, in order,
-until a non-zero (equivalent) result is achieved.
-
 =item can
 
  our Callable multi method can ($self:, Str $method)
@@ -157,19 +141,6 @@
 The second variant does the same, but any named arguments override an
 attribute during the cloning process.
 
-=item cmp
-
- our Order multi sub cmp (Ordering @by, $a, $b)
- our Order multi sub cmp (Ordering $by = infix:cmp, $a, $b)
-
-Returns COrder::Increase, or COrder::Same, or COrder::Decrease
-(which numify to -1, 0, +1 respectively) indicating if parameter C$a should
-be ordered before/tied with/after parameter C$b, using criteria
-C$by or C@by for comparisons. C@by differs from C$by
-in that each criterion is applied, in order, until a non-zero
-(tie) result is achieved.  If the values are not comparable,
-returns an COrder type object that is undefined.
-
 =item does
 
  our Bool multi method does ($self:, $type)



r31404 -[S12] sppelo

2010-06-21 Thread pugs-commits
Author: diakopter
Date: 2010-06-22 03:14:30 +0200 (Tue, 22 Jun 2010)
New Revision: 31404

Modified:
   docs/Perl6/Spec/S12-objects.pod
Log:
[S12] sppelo

Modified: docs/Perl6/Spec/S12-objects.pod
===
--- docs/Perl6/Spec/S12-objects.pod 2010-06-21 22:22:51 UTC (rev 31403)
+++ docs/Perl6/Spec/S12-objects.pod 2010-06-22 01:14:30 UTC (rev 31404)
@@ -1552,7 +1552,7 @@
 
 More generally, a parameter can have a set of constraints, and
 the set of constraints defines the formal type of the parameter,
-as visible to the signature.  (No one constraint is priviledged as
+as visible to the signature.  (No one constraint is privileged as
 the storage type of the actual argument, unless it is a native type.)
 All constraints considered in type narrowness.
 That is, these are equivalently narrow:



r31405 -[S12] verbo

2010-06-21 Thread pugs-commits
Author: diakopter
Date: 2010-06-22 03:17:22 +0200 (Tue, 22 Jun 2010)
New Revision: 31405

Modified:
   docs/Perl6/Spec/S12-objects.pod
Log:
[S12] verbo

Modified: docs/Perl6/Spec/S12-objects.pod
===
--- docs/Perl6/Spec/S12-objects.pod 2010-06-22 01:14:30 UTC (rev 31404)
+++ docs/Perl6/Spec/S12-objects.pod 2010-06-22 01:17:22 UTC (rev 31405)
@@ -1554,7 +1554,7 @@
 the set of constraints defines the formal type of the parameter,
 as visible to the signature.  (No one constraint is privileged as
 the storage type of the actual argument, unless it is a native type.)
-All constraints considered in type narrowness.
+All constraints are considered in type narrowness.
 That is, these are equivalently narrow:
 
 Foo Bar @x



r31376 -[S10] define how CANDO works with respect to lexically-scoped function name searches

2010-06-19 Thread pugs-commits
Author: lwall
Date: 2010-06-19 20:04:32 +0200 (Sat, 19 Jun 2010)
New Revision: 31376

Modified:
   docs/Perl6/Spec/S10-packages.pod
Log:
[S10] define how CANDO works with respect to lexically-scoped function name 
searches


Modified: docs/Perl6/Spec/S10-packages.pod
===
--- docs/Perl6/Spec/S10-packages.pod2010-06-19 08:21:04 UTC (rev 31375)
+++ docs/Perl6/Spec/S10-packages.pod2010-06-19 18:04:32 UTC (rev 31376)
@@ -13,8 +13,8 @@
 
 Created: 27 Oct 2004
 
-Last Modified: 19 Nov 2009
-Version: 11
+Last Modified: 19 Jun 2010
+Version: 12
 
 =head1 Overview
 
@@ -151,9 +151,6 @@
 
 =head1 Autoloading
 
-[Note: neither multisubs nor multimethods dispatch to package routines
-anymore, so this section will need revision/excision.]
-
 A package (or any other similar namespace) can control autoloading.
 However, Perl 5's CAUTOLOAD is being superseded by MMD autoloaders
 that distinguish declaration from definition, but are not restricted
@@ -220,4 +217,32 @@
 inherited but may still do MMD within the class.   (Ordinary multisubs
 are inherited only to the extent allowed by the MMD mechanism.)
 
+When the package in question is not a class, there is a slight problem
+insofar as Perl 6 doesn't by default look into packages for functions
+anymore, only lexical scopes.  However, we'd still like the ability
+to dynamic add functions to a package, so there are two ways to get
+around the lexical limitation.
+
+First, presuming you have a CCANDO that adds to your current package,
+you can simply call a newly-minted subroutine explicitly via the
+current package:
+
+OUR::$somename();
+
+This bypasses the lexical namespaces entirely.  Alternately, we can set up a
+mechanism whereby, if you import or define a CCANDO into a given lexical
+scope, all calls from within that scope register a failover that adds the
+current package to the list of places to look for subroutines (or, obviously,
+call the CCANDO as a last resort after that).  This is no performance
+impact on existing lexically scoped definitions, including those from CCORE.
+It does require that failures to find a function name be reported at run-time
+rather than compile time.  The package's routine names are also shadowed by
+all names defined in your outer lexical scopes, including CCORE.  If this
+is a problem, use the direct COUR call above.
+
+Another way to look at it is that a lexical CCANDO adds itself to
+the end of the function dispatcher's search, but sets up the current
+package as a kind of cache for newly-defined functions just ahead of itself
+in the search path.
+
 =for vim:set expandtab sw=4:



r31377 -[S10] fix thinkos and bad writing

2010-06-19 Thread pugs-commits
Author: lwall
Date: 2010-06-19 20:10:57 +0200 (Sat, 19 Jun 2010)
New Revision: 31377

Modified:
   docs/Perl6/Spec/S10-packages.pod
Log:
[S10] fix thinkos and bad writing


Modified: docs/Perl6/Spec/S10-packages.pod
===
--- docs/Perl6/Spec/S10-packages.pod2010-06-19 18:04:32 UTC (rev 31376)
+++ docs/Perl6/Spec/S10-packages.pod2010-06-19 18:10:57 UTC (rev 31377)
@@ -227,18 +227,19 @@
 you can simply call a newly-minted subroutine explicitly via the
 current package:
 
-OUR::$somename();
+OUR::($somename)();
 
-This bypasses the lexical namespaces entirely.  Alternately, we can set up a
-mechanism whereby, if you import or define a CCANDO into a given lexical
-scope, all calls from within that scope register a failover that adds the
-current package to the list of places to look for subroutines (or, obviously,
-call the CCANDO as a last resort after that).  This is no performance
-impact on existing lexically scoped definitions, including those from CCORE.
-It does require that failures to find a function name be reported at run-time
-rather than compile time.  The package's routine names are also shadowed by
-all names defined in your outer lexical scopes, including CCORE.  If this
-is a problem, use the direct COUR call above.
+This bypasses the lexical namespaces entirely.  Alternately, we can set
+up a mechanism whereby, if you import or define a CCANDO into a given
+lexical scope, all calls from within that scope register a failover that
+adds the current package to the list of places to look for subroutines (or,
+obviously, call the CCANDO as a last resort after that).  There is no
+performance impact on existing lexically scoped definitions, including those
+from CCORE.  This approach does require that failure to find a function name
+cannot be reported at compile time, but must be delayed till run time instead.
+Another potential disadvantage is that the package's symbols are also shadowed
+by all symbols defined in your outer lexical scopes, including CCORE.
+If this is a problem, use the direct COUR call above.
 
 Another way to look at it is that a lexical CCANDO adds itself to
 the end of the function dispatcher's search, but sets up the current



r31355 -[S06] order of candidates returned from .cando

2010-06-18 Thread pugs-commits
Author: moritz
Date: 2010-06-18 11:34:10 +0200 (Fri, 18 Jun 2010)
New Revision: 31355

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] order of candidates returned from .cando

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-06-18 09:25:29 UTC (rev 31354)
+++ docs/Perl6/Spec/S06-routines.pod2010-06-18 09:34:10 UTC (rev 31355)
@@ -3288,7 +3288,7 @@
 =item .cando(\$capture)
 
 This method returns a (potentially lazy) list of the candidates that match the 
given
-capture.
+capture, ordered by goodness of match, with the best match first.
 
 =item .push($candidate)
 



r31372 -[S06] spec processing of rw vs de-containerized return values

2010-06-18 Thread pugs-commits
Author: lwall
Date: 2010-06-19 04:24:36 +0200 (Sat, 19 Jun 2010)
New Revision: 31372

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] spec processing of rw vs de-containerized return values


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-06-19 00:01:35 UTC (rev 31371)
+++ docs/Perl6/Spec/S06-routines.pod2010-06-19 02:24:36 UTC (rev 31372)
@@ -16,8 +16,8 @@
 
 Created: 21 Mar 2003
 
-Last Modified: 21 May 2010
-Version: 134
+Last Modified: 18 Jun 2010
+Version: 135
 
 This document summarizes Apocalypse 6, which covers subroutines and the
 new type system.
@@ -2212,6 +2212,31 @@
 
 =head1 Advanced subroutine features
 
+=head2 Processing of returned values
+
+It is a general policy that lvalues should only be returned up the dynamic
+call stack if specifically requested.  Therefore, by default the returned
+arguments are processed to enforce this, both for the implicit return from
+the last statement of any block, as well as the explicit return done by
+operators such as:
+
+return
+leave
+take
+
+Specifically, this processing involves examining the returned parcel's
+arguments and dereferencing any container that could be used as an lvalue,
+replacing it with the container's value.
+
+To override this processing for a routine, it must be declared Crw, or
+the form Creturn-rw must be used.
+
+To override for a Cgather, use Cgather-rw instead, or Ctake-rw on the
+individual take.
+
+Since blocks don't generally have traits, you must use Cleave-rw to pass
+an lvalue out of a block.
+
 =head2 The Creturn function
 
 The Creturn function notionally throws a control exception that is



r31373 -[S03] explain more about the relationship of hypers with lazy infinitude

2010-06-18 Thread pugs-commits
Author: lwall
Date: 2010-06-19 04:55:36 +0200 (Sat, 19 Jun 2010)
New Revision: 31373

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] explain more about the relationship of hypers with lazy infinitude


Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-06-19 02:24:36 UTC (rev 31372)
+++ docs/Perl6/Spec/S03-operators.pod   2010-06-19 02:55:36 UTC (rev 31373)
@@ -15,8 +15,8 @@
 
 Created: 8 Mar 2004
 
-Last Modified: 15 Jun 2010
-Version: 209
+Last Modified: 18 Jun 2010
+Version: 210
 
 =head1 Overview
 
@@ -4222,6 +4222,23 @@
 
 @array[0...@array], @array[*-1] xx *
 
+Note that hypers promise that you don't care what order the processing
+happens in, only that the resulting structure ends up in a form consistent
+with the inputs.  There is no promise from the system that the operation
+Iwill be parallelized.  Effective parallelization requires some means
+of partitioning the work without doing more extra work than you save.
+This will differ from structure to structure.  In particular, infinite
+structures cannot be completely processed, and the system is allowed to
+balance out the demands of laziness with parallel processing.  For instance,
+an algorithm that wants to divide a list into two equal sublists will not
+work if you have to calculate the length in advance, since you can't always
+calculate the length.  Various approaches can be taken: handing off batches
+to be processed in parallel on demand, or interleaving roundrobin with a
+set of N processors, or whatever.  In the limit, a simple, non-parallel,
+item-by-item lazy implementation is within spec, but unlikely to use multiple
+cores efficiently.  Outside of performance requirements, if the algorithm
+depends on which of these approaches is taken, it is erroneous.
+
 =head2 Reduction operators
 
 Any infix operator (except for non-associating operators)



r31337 -[S02] allow _ between radix and digits as suggested by ajs++

2010-06-17 Thread pugs-commits
Author: lwall
Date: 2010-06-18 01:49:13 +0200 (Fri, 18 Jun 2010)
New Revision: 31337

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
[S02] allow _ between radix and digits as suggested by ajs++


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-06-17 21:54:34 UTC (rev 31336)
+++ docs/Perl6/Spec/S02-bits.pod2010-06-17 23:49:13 UTC (rev 31337)
@@ -3042,6 +3042,8 @@
 
 A single underscore is allowed only between any two digits in a
 literal number, where the definition of digit depends on the radix.
+(A single underscore is also allowed between a radix prefix and a
+following digit, as explained in the next section.)
 Underscores are not allowed anywhere else in any numeric literal,
 including next to the radix point or exponentiator, or at the beginning
 or end.
@@ -3056,6 +3058,13 @@
 0d  base 10, digits 0..9
 0x  base 16, digits 0..9,a..f (case insensitive)
 
+Each of these allows an optional underscore after the radix prefix
+but before the first digit.  These all mean the same thing:
+
+0xbadcafe
+0xbad_cafe
+0x_bad_cafe
+
 =item *
 
 The general radix form of a number involves prefixing with the radix



r31270 -[S03] guarantee a monotonic function when single characters are used in a series

2010-06-15 Thread pugs-commits
Author: lwall
Date: 2010-06-15 22:35:27 +0200 (Tue, 15 Jun 2010)
New Revision: 31270

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] guarantee a monotonic function when single characters are used in a series


Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-06-15 20:23:57 UTC (rev 31269)
+++ docs/Perl6/Spec/S03-operators.pod   2010-06-15 20:35:27 UTC (rev 31270)
@@ -15,8 +15,8 @@
 
 Created: 8 Mar 2004
 
-Last Modified: 7 Jun 2010
-Version: 208
+Last Modified: 15 Jun 2010
+Version: 209
 
 =head1 Overview
 
@@ -2026,16 +2026,37 @@
 
 1..20, ... I only know up to 20 so far mister
 
+A special exception is made for any series whose endpoints are strings that
+happen to represent single codepoints, since the user will typically be 
thinking
+of such strings as characters rather than strings.  If you say something like:
+
+'A' ... 'z'
+\xff ... \0
+
+it is assumed that you aren't interested in carrying within alphabetic
+ranges, so instead of using the ordinary C.succ/C.pred for
+strings, it uses a monotonic function that increments or decrements
+the underlying codepoint number like
+
+'A', { $^prev.ord.succ.chr } ... 'z';
+\xff, { $^prev.ord.pred.chr } ... \0;
+
+You will note that this alternate definition doesn't change the meaning of
+any sequence that falls within a conventional range:
+
+'a'..'z'
+'9'..'0'
+
 If a series is generated using a non-monotonic C.succ function, it is
 possible for it never to reach the endpoint.  The following matches:
 
-'A' ... 'Z'
+'A' ... 'ZZ'
 
 but since 'Z' increments to 'AA', none of these ever terminate:
 
-'A' ... 'z'
-'A' ... '_'
-'A' ... '~'
+'A' ... 'zz'
+'A' ... '00'
+'A' ... '~~'
 
 The compiler is allowed to complain if it notices these, since if you
 really want the infinite list you can always write:
@@ -2050,20 +2071,20 @@
 
 The astute reader will note that
 
-'A' ... 'Z'
+'A' ... 'ZZ'
 
 doesn't terminate with a simple C!after test either.  The actual function 
used
 is something like:
 
-'A', *.succ ... - $old,$new { $old ne 'Z' and $new !after 'Z'; }
+'A', *.succ ... - $old,$new { $old ne 'ZZ' and $new !after 'ZZ'; }
 
 Likewise, since Z comes after A:
 
-'Z' ... 'A'
+'ZZ' ... 'AA'
 
 uses the function:
 
-'Z', *.pred ... - $old,$new { $old ne 'A' and $new !before 'A'; }
+'ZZ', *.pred ... - $old,$new { $old ne 'AA' and $new !before 'AA'; }
 
 For purposes of deciding when to terminate the eager part of a 'mostly
 eager' list, any series that terminates with an exact value (or



r31271 -[S03] typos spotted by masak++

2010-06-15 Thread pugs-commits
Author: lwall
Date: 2010-06-15 23:05:57 +0200 (Tue, 15 Jun 2010)
New Revision: 31271

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[S03] typos spotted by masak++


Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-06-15 20:35:27 UTC (rev 31270)
+++ docs/Perl6/Spec/S03-operators.pod   2010-06-15 21:05:57 UTC (rev 31271)
@@ -2042,10 +2042,10 @@
 \xff, { $^prev.ord.pred.chr } ... \0;
 
 You will note that this alternate definition doesn't change the meaning of
-any sequence that falls within a conventional range:
+any sequence that falls within a conventional rangechar range:
 
-'a'..'z'
-'9'..'0'
+'a'...'z'
+'9'...'0'
 
 If a series is generated using a non-monotonic C.succ function, it is
 possible for it never to reach the endpoint.  The following matches:
@@ -2109,7 +2109,7 @@
 
 0,1,2 ...^ 100,42# same as ^100,42
 
-There is no corresponding exclusion on the left side.  The compile
+There is no corresponding exclusion on the left side.  The compiler
 may complain if it sees anything on the right that is not a literal:
 
 0,1,2 ...^ *



r31189 -[S06] print default usage messag to standard output, by petition from avar++

2010-06-11 Thread pugs-commits
Author: moritz
Date: 2010-06-11 08:11:20 +0200 (Fri, 11 Jun 2010)
New Revision: 31189

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] print default usage messag to standard output, by petition from avar++

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-06-10 20:20:37 UTC (rev 31188)
+++ docs/Perl6/Spec/S06-routines.pod2010-06-11 06:11:20 UTC (rev 31189)
@@ -3101,7 +3101,8 @@
 semicolon-style declaration that controls the whole file.
 
 If an attempted dispatch to CMAIN fails, the CUSAGE routine is called.
-If there is no CUSAGE routine, a default message is printed.  This
+If there is no CUSAGE routine, a default message is printed to standard
+output.  This
 usage message is automatically generated from the signature (or
 signatures) of CMAIN.  This message is generated at compile time,
 and hence is available at any later time as C$?USAGE.



r31190 -[S06] more elaborate $*OUT/$*ERR selection for USAGE printing

2010-06-11 Thread pugs-commits
Author: moritz
Date: 2010-06-11 09:53:58 +0200 (Fri, 11 Jun 2010)
New Revision: 31190

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] more elaborate $*OUT/$*ERR selection for USAGE printing

This should make both avar++ happy who wants './prog --help|less' to DWHM,
and also TheDamian, who wants in good UNIX tradition a pipe of the form
'./prog | sort  file' to print usage messages to $*ERR to catch mistakes.

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2010-06-11 06:11:20 UTC (rev 31189)
+++ docs/Perl6/Spec/S06-routines.pod2010-06-11 07:53:58 UTC (rev 31190)
@@ -3102,8 +3102,11 @@
 
 If an attempted dispatch to CMAIN fails, the CUSAGE routine is called.
 If there is no CUSAGE routine, a default message is printed to standard
-output.  This
-usage message is automatically generated from the signature (or
+error. If the CMAIN routine does not declare a named parameter C:$help,
+and C--help is passed as a command line argument to the program, the usage
+message is printed to standard output instead.
+
+This usage message is automatically generated from the signature (or
 signatures) of CMAIN.  This message is generated at compile time,
 and hence is available at any later time as C$?USAGE.
 



r31193 -[spec] Document Numeric.Real, Numeric.Int, Numeric.Rat, Numeric.Num, and Real.Str.

2010-06-11 Thread pugs-commits
Author: colomon
Date: 2010-06-11 17:10:23 +0200 (Fri, 11 Jun 2010)
New Revision: 31193

Modified:
   docs/Perl6/Spec/S32-setting-library/Numeric.pod
Log:
[spec] Document Numeric.Real, Numeric.Int, Numeric.Rat, Numeric.Num, and 
Real.Str.

Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod
===
--- docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-06-11 15:04:22 UTC 
(rev 31192)
+++ docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-06-11 15:10:23 UTC 
(rev 31193)
@@ -19,8 +19,8 @@
 
 Created: 19 Mar 2009 extracted from S29-functions.pod
 
-Last Modified: 26 May 2010
-Version: 8
+Last Modified: 11 June 2010
+Version: 9
 
 The document is a draft.
 
@@ -71,6 +71,35 @@
 
 =over
 
+=item Real
+
+ our Real multi method Real ()
+
+If this CNumeric is equivalent to a CReal, return that CReal.  
+(For instance, if this number is a CComplex with a zero imaginary part.)  
+Fail otherwise.
+
+=item Int
+
+ our Int multi method Int ()
+
+If this CNumeric is equivalent to a CReal, return the equivalent of
+calling Ctruncate on that CReal to get an CInt. 
+
+=item Rat
+
+ our Rat multi method Rat ( Real $epsilon = 1.0e-6 )
+
+If this CNumeric is equivalent to a CReal, return a CRat which is
+within C$epsilon of that CReal's value.
+
+=item Num
+
+ our Num multi method Num ()
+
+If this CNumeric is equivalent to a CReal, return that CReal as a CNum
+as accurately as is possible.
+
 =item succ
 
  our Numeric multi method succ ( Numeric $x: ) is export
@@ -174,30 +203,19 @@
 
 =over
 
-=item Int
+=item Complex
 
- our Int multi method Int ()
+ our Complex multi method Complex ()
 
-Converts this CReal to an CInt as if Ctruncate had been called.
+Returns a CComplex whose real part is this CReal and whose imaginary part 
is 0.
 
-=item Rat
+=item Str
 
- our Rat multi method Rat ( Real $epsilon = 1.0e-6 )
+ our Str multi method Str ()
 
-Converts this CReal to a CRat with an accuracy of C$epsilon.
+Returns the CReal as a CStr.  All built-in CReal types format it as a 
decimal 
+number, so for example, the CRat C5/4 is returned as C1.2.
 
-=item Num
-
- our Num multi method Num ()
-
-Converts this CReal to a CNum as accurately as is possible for a CNum.
-
-=item Complex
-
- our Complex multi method Complex ()
-
-Returns a CComplex whose real part is this CReal and whose imaginary part 
is 0.
-
 =item floor
 
  our Int multi method floor ( Real $x: ) is export



r31195 -[S05] mention TOP, and explain how parsing is initiated and how it actually works

2010-06-11 Thread pugs-commits
Author: lwall
Date: 2010-06-11 19:00:19 +0200 (Fri, 11 Jun 2010)
New Revision: 31195

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] mention TOP, and explain how parsing is initiated and how it actually 
works


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-06-11 15:22:00 UTC (rev 31194)
+++ docs/Perl6/Spec/S05-regex.pod   2010-06-11 17:00:19 UTC (rev 31195)
@@ -16,8 +16,8 @@
 
 Created: 24 Jun 2002
 
-Last Modified: 4 Jun 2010
-Version: 124
+Last Modified: 11 Jun 2010
+Version: 125
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them Iregex rather than regular
@@ -1953,6 +1953,10 @@
 
 (This is true for all quotelike constructs in Perl 6.)
 
+The Crx form may be used directly as a pattern anywhere a normal C// match 
can.
+The Cregex form is really a method definition, and must be used in such a 
way that
+the grammar class it is to be used in is apparent.
+
 =item *
 
 If either form needs modifiers, they go before the opening delimiter:
@@ -3921,11 +3925,28 @@
 
 =item *
 
-A string can be matched against a grammar by calling C.parse on the grammar,
-and optionally pass an Iactions object to that grammar:
+A string can be matched against a grammar by calling C.parse
+or C.parsefile on the grammar, and optionally pass an Iactions
+object to that grammar:
 
-MyGrammar.parse($str, :actions($action-object))
+MyGrammar.parse($string, :actions($action-object))
+MyGrammar.parse($filename, :actions($action-object))
 
+This creates a CGrammar object, whose type denotes the current language being
+parsed, and from which other grammars may be derived as extended languages.
+All grammar objects are derived from CCursor, so every grammar object's
+value embodies the current state of the current match.  This new grammar
+object is then passed as the invocant to the CTOP method (regex, token,
+or rule) of CMyGrammar.  Grammar objects are considered immutable, so
+every match returns a different match state, and multiple match states may
+exist simultaneously.  Each such match state is considered a hypothesis on
+how the pattern will eventually match.  A backtrackable choice in pattern
+matching may be easily represented in Perl 6 as a lazy list of match state
+cursors; backtracking consists of merely throwing away the front value of
+the list and continuing to match with the next value.  Hence, the management
+of these match cursors controls how backtracking works, and falls naturally
+out of the lazy list paradigm.
+
 =back
 
 =head1 Syntactic categories



r31159 -[spec] Change div and mod to be operators on integer types.

2010-06-07 Thread pugs-commits
Author: colomon
Date: 2010-06-07 14:09:36 +0200 (Mon, 07 Jun 2010)
New Revision: 31159

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
[spec] Change div and mod to be operators on integer types.

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2010-06-07 08:27:52 UTC (rev 31158)
+++ docs/Perl6/Spec/S03-operators.pod   2010-06-07 12:09:36 UTC (rev 31159)
@@ -15,8 +15,8 @@
 
 Created: 8 Mar 2004
 
-Last Modified: 2 Jun 2010
-Version: 207
+Last Modified: 7 Jun 2010
+Version: 208
 
 =head1 Overview
 
@@ -748,12 +748,12 @@
 
 =item *
 
-C infix:div , generic division
+C infix:div , integer division
 
 $numerator div $denominator
 
 Dispatches to the C infix:div  multi most appropriate to the
-operand types, typically returning a value of the same type.
+operand types, returning a value of the same type.
 Not coercive, so fails on differing types.
 
 Policy on what to do about division by zero is up to the type,
@@ -764,11 +764,12 @@
 use in hyperops and junctions, and whether they can profitably benefit
 from a lazy exception model.)
 
-Use of Cdiv on built-in integer types is equivalent to taking the
-floor of a real division:
+In general, Cdiv should give the same result as 
 
 $x div $y == floor($x/$y);
 
+but the return value should be the same type as $x.
+
 =item *
 
 C infix:% , modulo
@@ -782,15 +783,15 @@
 
 =item *
 
-C infix:mod , generic modulo
+C infix:mod , integer modulo
 
 $x mod $y
 
 Dispatches to the C infix:mod  multi most appropriate to
-the operand types, typically returning a value of the same type.
+the operand types, returning a value of the same type.
 Not coercive, so fails on differing types.
 
-For built-in types, preserves the identity
+This should preserve the identity
 
 $x mod $y == $x - ($x div $y) * $y
 



r31166 -[S32] fix a grammero

2010-06-07 Thread pugs-commits
Author: moritz
Date: 2010-06-07 22:01:26 +0200 (Mon, 07 Jun 2010)
New Revision: 31166

Modified:
   docs/Perl6/Spec/S32-setting-library/Basics.pod
Log:
[S32] fix a grammero

Modified: docs/Perl6/Spec/S32-setting-library/Basics.pod
===
--- docs/Perl6/Spec/S32-setting-library/Basics.pod  2010-06-07 18:56:19 UTC 
(rev 31165)
+++ docs/Perl6/Spec/S32-setting-library/Basics.pod  2010-06-07 20:01:26 UTC 
(rev 31166)
@@ -197,7 +197,7 @@
 Throws a resumable warning exception, which is considered a control
 exception, and hence is invisible to most normal exception handlers.
 The outermost control handler will print the warning to C$*ERR
-(which is usually finds C$PROCESS::ERR; see CSynopsis 16: IPC /
+(which usually finds C$PROCESS::ERR; see CSynopsis 16: IPC /
 IO / Signals for details).  After printing the warning, the exception
 is resumed where it was thrown.  To override this behavior, catch the
 exception in a CONTROL block.  A quietly {...} block is the opposite of a



r31128 -[S05] posit that cursor lists may be returned to a regex with .gather { take ... }

2010-06-05 Thread pugs-commits
Author: lwall
Date: 2010-06-05 21:02:35 +0200 (Sat, 05 Jun 2010)
New Revision: 31128

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] posit that cursor lists may be returned to a regex with .gather { take 
... }


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-06-05 18:54:13 UTC (rev 31127)
+++ docs/Perl6/Spec/S05-regex.pod   2010-06-05 19:02:35 UTC (rev 31128)
@@ -1340,7 +1340,7 @@
 
 is sugar for something like:
 
- foo($¢,1,2,3)
+ .gather { take foo($¢,1,2,3) }
 
 where C$¢ represents the current incoming match state, and the
 routine must return CNil for failure, or a lazy list of one or or



r31116 -Made some changes based on S05 -- they may even be right :).

2010-06-04 Thread pugs-commits
Author: wayland
Date: 2010-06-05 01:33:27 +0200 (Sat, 05 Jun 2010)
New Revision: 31116

Modified:
   docs/Perl6/Spec/S32-setting-library/Rules.pod
Log:
Made some changes based on S05 -- they may even be right :).  


Modified: docs/Perl6/Spec/S32-setting-library/Rules.pod
===
--- docs/Perl6/Spec/S32-setting-library/Rules.pod   2010-06-04 22:52:12 UTC 
(rev 31115)
+++ docs/Perl6/Spec/S32-setting-library/Rules.pod   2010-06-04 23:33:27 UTC 
(rev 31116)
@@ -31,12 +31,19 @@
 
 =head2 Match
 
-role Match {
-method Int from()  {...}
-method Int to(){...}
-method Int chars() {...}
-method orig()  {...}
-method Str()   {...}
+role Match does Positional does Associative {
+method Int from()   {...}
+method Int to() {...}
+method Int chars()  {...}
+method orig()   {...}
+method ast(){...}
+method caps()   {...}
+method chunks() {...}
+method pos(){...}
+
+method bool()   {...}
+method Str(){...}
+method Num(){...}
 }
 
 =head2 Cursor



r31117 -[S05] some clarifications suggested by sorear++

2010-06-04 Thread pugs-commits
Author: lwall
Date: 2010-06-05 02:28:09 +0200 (Sat, 05 Jun 2010)
New Revision: 31117

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] some clarifications suggested by sorear++


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-06-04 23:33:27 UTC (rev 31116)
+++ docs/Perl6/Spec/S05-regex.pod   2010-06-05 00:28:09 UTC (rev 31117)
@@ -16,8 +16,8 @@
 
 Created: 24 Jun 2002
 
-Last Modified: 26 May 2010
-Version: 122
+Last Modified: 4 Jun 2010
+Version: 123
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them Iregex rather than regular
@@ -1319,7 +1319,9 @@
 As with all regex matching, the current match state (some derivative
 of CCursor) is passed as the first argument, which in this case
 is simply the method's invocant.  The method is expected to return
-a new match state object.
+a lazy list of new match state objects, or CNil if the match fails
+entirely.  Ratcheted routines will typicaly return a list containing only
+one match.
 
 =item *
 
@@ -1338,9 +1340,11 @@
 
 is sugar for something like:
 
- { $¢ = foo($¢,1,2,3) }
+ foo($¢,1,2,3)
 
-(where C$¢ represents the current match state in the outer match).
+where C$¢ represents the current incoming match state, and the
+routine must return CNil for failure, or a lazy list of one or or
+more match states (CCursor-derived objects) for successful matches.
 
 As with the C. form, an explicit C suppresses capture.
 



r31118 -[S05] typo

2010-06-04 Thread pugs-commits
Author: allbery_b
Date: 2010-06-05 04:52:12 +0200 (Sat, 05 Jun 2010)
New Revision: 31118

Modified:
   docs/Perl6/Spec/S05-regex.pod
Log:
[S05] typo


Modified: docs/Perl6/Spec/S05-regex.pod
===
--- docs/Perl6/Spec/S05-regex.pod   2010-06-05 00:28:09 UTC (rev 31117)
+++ docs/Perl6/Spec/S05-regex.pod   2010-06-05 02:52:12 UTC (rev 31118)
@@ -17,7 +17,7 @@
 Created: 24 Jun 2002
 
 Last Modified: 4 Jun 2010
-Version: 123
+Version: 124
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them Iregex rather than regular
@@ -1320,7 +1320,7 @@
 of CCursor) is passed as the first argument, which in this case
 is simply the method's invocant.  The method is expected to return
 a lazy list of new match state objects, or CNil if the match fails
-entirely.  Ratcheted routines will typicaly return a list containing only
+entirely.  Ratcheted routines will typically return a list containing only
 one match.
 
 =item *



r31081 -[S32/Str] proposed Str.indent

2010-06-03 Thread pugs-commits
Author: masak
Date: 2010-06-03 15:35:39 +0200 (Thu, 03 Jun 2010)
New Revision: 31081

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] proposed Str.indent

Following an idea bounced around on #perl6, this method was added.

Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-06-03 13:07:35 UTC (rev 
31080)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-06-03 13:35:39 UTC (rev 
31081)
@@ -583,6 +583,20 @@
 
  our multi trans(List of Pair %data);
 
+=item indent
+
+ our Str multi method indent ($str: $steps) is export;
+
+Returns a re-indented string wherein C$steps number of spaces have been added
+to each line (i.e. to the beginning of the string and after each logical
+newline).
+
+If C$steps is negative, removes that many spaces instead. Should any line
+contain too few leading spaces, only those are removed and a warning is issued.
+
+Only spaces are considered indentation; tabs or other Unicode whitespace
+characters are not considered.
+
 =back
 
 =head1 Additions



  1   2   3   4   5   6   7   8   9   10   >