Re: r28597 - docs/Perl6/Spec/S32-setting-library

2009-10-05 Thread David Green

On 2009-Oct-4, at 2:07 pm, Moritz Lenz wrote:

Michael Zedeler wrote:
It doesn't, because succ should always give the next, smallest  
possible

element given some ordering relation.


Where's that definition from?


The dictionary.  =)  It would be confusing to have a successor  
method for something that isn't orderable and discrete.  An ordered  
continuous type like Real could have .inc and .dec; it just happens  
that in the common case of Ints, .succ and .inc mean the same thing.


Complex could have an .inc method, but I don't think there's any  
especially obvious choice (because .inc probably wants an ordered  
type).  Would it add 1? or 1+i?  Better to spell it out explicitly.



Well, Real implies ordering (at least to me ;-), I don't think we  
have a

class or role for countability.


A Discrete role would be useful, but is Set good enough for that?



-David



r28619 - docs/Perl6/Spec

2009-10-05 Thread pugs-commits
Author: Darren_Duncan
Date: 2009-10-05 10:00:51 +0200 (Mon, 05 Oct 2009)
New Revision: 28619

Modified:
   docs/Perl6/Spec/S03-operators.pod
Log:
Spec S03 : added cases where a Range is considered empty

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2009-10-05 06:58:07 UTC (rev 28618)
+++ docs/Perl6/Spec/S03-operators.pod   2009-10-05 08:00:51 UTC (rev 28619)
@@ -3079,12 +3079,12 @@
 inclusive of the endpoints, whereas 1^..^2 excludes the endpoints
 but matches any real number in between.
 
-Range objects support C.min and a C.max methods representing
+Range objects support C.min and C.max methods representing
 their left and right arguments.  The C.minmax method returns both
 values as a two-element list representing the interval.  Ranges are
 not autoreversing: C2..1 is always a null range.
 
-Range objects support the C.excl_min and C.excl_max methods
+Range objects support C.excl_min and C.excl_max methods
 representing the exclusion (has C^) or inclusion (no C^) of each
 endpoint in the Range.
 
@@ -3140,7 +3140,11 @@
 May..*  # May through December
 
 An empty range cannot be iterated; it returns a CNil instead.  An empty
-range still has a defined min and max, but the min is greater than the max.
+range still has a defined C.min and C.max, but one of the following is
+true:  1. The C.min is greater than the C.max.  2. The C.min is equal
+to the C.max Iand at least one of C.excl_min or C.excl_max is true.
+3. Both C.excl_min and C.excl_max are true Iand C.min and C.max
+are consecutive values.
 
 Ranges that are iterated transmute into the corresponding series operator,
 and hence use C!after semantics to determine an end to the sequence.



r28622 - in docs/Perl6/Spec: . S32-setting-library

2009-10-05 Thread pugs-commits
Author: lwall
Date: 2009-10-05 17:32:04 +0200 (Mon, 05 Oct 2009)
New Revision: 28622

Modified:
   docs/Perl6/Spec/S03-operators.pod
   docs/Perl6/Spec/S32-setting-library/Numeric.pod
Log:
[S03] dehuffmanize excl_* slightly to emphasize boolean nature to reader
[S32] add i as constant


Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2009-10-05 14:38:57 UTC (rev 28621)
+++ docs/Perl6/Spec/S03-operators.pod   2009-10-05 15:32:04 UTC (rev 28622)
@@ -9,13 +9,14 @@
 
 Luke Palmer l...@luqui.org
 Larry Wall la...@wall.org
+Darren Duncan dar...@darrenduncan.net
 
 =head1 VERSION
 
 Created: 8 Mar 2004
 
-Last Modified: 29 Sep 2009
-Version: 174
+Last Modified: 5 Sep 2009
+Version: 175
 
 =head1 Overview
 
@@ -3084,16 +3085,16 @@
 values as a two-element list representing the interval.  Ranges are
 not autoreversing: C2..1 is always a null range.
 
-Range objects support C.excl_min and C.excl_max methods
+Range objects support C.excludes_min and C.excludes_max methods
 representing the exclusion (has C^) or inclusion (no C^) of each
 endpoint in the Range.
 
-Range  | .min | .max | .excl_min   | .excl_max
+Range  | .min | .max | .excludes_min | .excludes_max
 ---+--+--+-+
-1..10  | 1| 10   | Bool::False | Bool::False
-2.7..^9.3  | 2.7  | 9.3  | Bool::False | Bool::True
-'a'^..'z'  | 'a'  | 'z'  | Bool::True  | Bool::False
-1^..^10| 1| 10   | Bool::True  | Bool::True
+1..10  | 1| 10   | Bool::False   | Bool::False
+2.7..^9.3  | 2.7  | 9.3  | Bool::False   | Bool::True
+'a'^..'z'  | 'a'  | 'z'  | Bool::True| Bool::False
+1^..^10| 1| 10   | Bool::True| Bool::True
 
 If used in a list context, a CRange object returns an iterator that
 produces a series of values starting at the min and ending at the max.
@@ -3142,8 +3143,8 @@
 An empty range cannot be iterated; it returns a CNil instead.  An empty
 range still has a defined C.min and C.max, but one of the following is
 true:  1. The C.min is greater than the C.max.  2. The C.min is equal
-to the C.max Iand at least one of C.excl_min or C.excl_max is true.
-3. Both C.excl_min and C.excl_max are true Iand C.min and C.max
+to the C.max Iand at least one of C.excludes_min or C.excludes_max is 
true.
+3. Both C.excludes_min and C.excludes_max are true Iand C.min and 
C.max
 are consecutive values.
 
 Ranges that are iterated transmute into the corresponding series operator,

Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod
===
--- docs/Perl6/Spec/S32-setting-library/Numeric.pod 2009-10-05 14:38:57 UTC 
(rev 28621)
+++ docs/Perl6/Spec/S32-setting-library/Numeric.pod 2009-10-05 15:32:04 UTC 
(rev 28622)
@@ -67,6 +67,7 @@
 
 constant pi is export = 3.14159_26535_89793_23846_26433_83279_50288;
 constant e  is export = 2.71828_18284_59045_23536_02874_71352_66249;
+constant i  is export = 1i;
 
 =over
 



Overloading Roles

2009-10-05 Thread Jon Lang
Consider a Range role that is parameterized (i.e., Range of T is a
perfectly valid thing to do).  According to the spec, the definition of
Range depends on the nature of T:

* If the lower bound is Numeric, certain coercion rules are attempted on the
upper bound; otherwise, the two boundaries must have the same type.
** Speculation: if the lower bound is a Whatever, the boundary type should
be determined by the upper bound; if both are Whatever, treat it as Numeric?
* if the boundary type has a .succ method, then the Range can provide a
RangeIterator; otherwise, it can't.

Concerning that last one: would it be reasonable to have a Discrete role
that provides a .succ method, and then overload the Range role?  E.g.:

role Range[Ordered ::T] { ... }

role Range[Ordered Discrete ::T] {
...
method iterator ( - RangeIterator ) { ... }
}

If so, then this approach might also be used to handle the special behavior
that comes with Numeric types:

role Range[Ordered Numeric ::T] { ... }

-- 
Jonathan Dataweaver Lang


r28632 - docs/Perl6/Spec/S32-setting-library

2009-10-05 Thread pugs-commits
Author: lwall
Date: 2009-10-06 02:47:27 +0200 (Tue, 06 Oct 2009)
New Revision: 28632

Modified:
   docs/Perl6/Spec/S32-setting-library/IO.pod
Log:
[IO] clarify semantics and usage of note()


Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===
--- docs/Perl6/Spec/S32-setting-library/IO.pod  2009-10-05 23:51:25 UTC (rev 
28631)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod  2009-10-06 00:47:27 UTC (rev 
28632)
@@ -22,7 +22,7 @@
 
 Created: 19 Feb 2009 extracted from S29-functions.pod; added stuff from 
S16-IO later
 
-Last Modified: 1 Oct 2009
+Last Modified: 5 Oct 2009
 Version: 8
 
 The document is a draft.
@@ -448,8 +448,14 @@
 
 =item multi note (*...@list -- Bool)
 
-Does a say to C$*ERR.
+Does a say to C$*ERR, more or less.  Like Cwarn, it adds a
+newline only if the message does not already end in newline.  Unlike
+Cwarn, it is not trappable as a resumable exception because it
+outputs directly to C$*ERR.  You can suppress notes in a lexical
+scope by declaring:
 
+only note(*@) {}
+
 =item method printf ($self: Str $fmt, *...@list -- Bool)
 
 =item multi printf (Str $fmt, *...@list -- Bool)