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

2010-07-16 Thread Minimiscience

On 16 Jul 2010, at 14:39, pugs-comm...@feather.perl6.nl wrote:

Because all C types are well-ordered


Oh, they are?  Just how are we implementing that?  says that the de facto standard foundations of mathematics are  
insufficient to define a formula for well-ordering the reals.  Even if  
we just consider arbitrary-precision rationals, what's the least  
element of C<3 ... { (2 * $^p + 2) / ($^p + 2) }>?  This sequence  
consists of infinitely many rationals in which each element is less  
than its predecessor yet greater than sqrt(2), so there is no least  
element under the ≤ ordering.  If only C types were required to  
have a *total* ordering rather than a *well*-ordering; things would be  
so much simpler.


-- Minimiscience

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

2010-07-16 Thread Darren Duncan

pugs-comm...@feather.perl6.nl wrote:

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.

+Users who provide their own scalar real numeric types are encouraged to 
implement the
+C role.  Because all C types are well-ordered, it is desirable 
that any two
+C types be mutally compatiable, even if they are not aware of each 
other.  The
+current proposal requires you to define a C method in your C 
type, which
+converts your type into a neutral C type by restating it in terms of the 
fundamental
+Perl 6 types and calling C on them.  This then makes the default 
C methods
+and operators all work with your C type.  While the name of this method 
may changed,
+it is hoped that something like this will remain in the spec.


Is there some type or role named "Bridge", such that "Bridge" would be casting 
as such?  Because if not, I would think you'd want the method to not be 
capitalized, unless there is some other precedent for doing so. -- Darren Duncan


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 @@
 
 C is a role for everything that's a scalar number. So C, C,
 C, C and other numeric types do that role. However it is an
-abstract interface, so C<$number.WHAT> will never return C. Users who
-provide their own scalar numeric types are encouraged to implement the
-C role.
+abstract interface, so C<$number.WHAT> will never return C. 
 
+Users who provide their own scalar numeric types are encouraged to implement 
the
+C 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 
C
+role for scalar numeric types that represent real numbers.)
+
 The following are all defined in the C role:
 
 C provides some constants in addition to the basic
@@ -201,6 +207,15 @@
 a real scalar number (i.e. neither C nor vector-like). For example
 C, C, C and C implement the C role.
 
+Users who provide their own scalar real numeric types are encouraged to 
implement the
+C role.  Because all C types are well-ordered, it is desirable 
that any two
+C types be mutally compatiable, even if they are not aware of each 
other.  The
+current proposal requires you to define a C method in your C 
type, which
+converts your type into a neutral C type by restating it in terms of the 
fundamental
+Perl 6 types and calling C on them.  This then makes the default 
C methods
+and operators all work with your C type.  While the name of this method 
may changed,
+it is hoped that something like this will remain in the spec.
+
 =over
 
 =item Complex