Outline: Numeric Types and Values

[email protected] (Michael Lazzaro)
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
Since we're having trouble finding a common voice, let's drill into one 
particular aspect of Section 1: Numerics, since that's what we've been 
talking about (and we have Angel's text to work from.)

Forget the rest of Section 1, let's just do this one small fragment.

There are a number of topics which must be covered when exploring how 
basic typed/untyped numbers will work in Perl6.  At minimum:

-----

- introducing the basic numeric types, C<int>, C<num>, C<bit>

- literal values   (Angel's doc)
     - integer and decimal literals
     - scientific/exponential notation
     - binary/octal/hex
     - radix
         - using letters
         - using dots
     - how underscore may be used
     - Infinity
     - NaN

- how numbers behave in other contexts
     - boolean context
     - string context
     - ints in num context, nums in int context, etc.

- converting strings to numbers
     (note that stringified numbers aren't literals,
      and have different rules in Perl5)
     - reading a string as a number
     - reading a string as a bin/oct/hex/radix (formatted) number

- converting numbers to strings
     - writing a number as a string
         (what the rules are for how it will look)
     - writing a number as a formatted string
         (how you write something as bin/oct/hex/radix)
         (how you write something w/ other formatting)

- Int vs. int, Num vs. num, Bit vs. bit

- numeric precision and overflow/out-of-range errors
     - (when it happens, what happens)
     - (issues with floating point numbers)

- a full reference to all numeric types
     (all the things like 'u_long' needed for C libraries, etc.)

-----

Though the ordering here might be wrong, and we're probably still 
missing things, EACH of these represents a subsection in the tree 
(something that a user will want to be able to find by name) and EACH 
needs at least a paragraph and a few code samples to describe it.

It's also probably a good assumption that someone looking for how to 
write a numeric literal is more interested in "numerics" than in 
"literals", which implies that we describe literal numbers in the 
numerics section, and literal strings in the string section, rather 
than the perl5 approach of describing them both together.  So that's 
where we snip the sections.

(Again, a very crude example of a depth-first structure like this is at 
http://cog.cognitivity.com/perl6/val.html.  It's got some errors, and 
isn't divided out as much, but it shows that it is possible.)

-----

Does anyone want to work on individual parts of this section?  (Angel's 
got the literal values part going pretty good).

If so, say so here, so someone else doesn't duplicate your work!!

MikeL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.