Design Team Issues: Numeric Types

[email protected] (Michael Lazzaro) Mon, 18 Nov 2002 11:22:00 -0800
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
Here are some issues we need the design team to decide.

(A) How shall C-like primitive types be specified, e.g. for binding 
to/from C library routines, etc?

   Option 1: specify as property

     my numeric $a is ctype("unsigned long int");  # standard C type
     my numeric $b is ctype("my_int32");           # user-defined
     my numeric $c is ctype("long double");

     my int $a is range(1000..1255) is unchecked;  # auto-infer 8bit

   Option 2: specify as type

     my u_long      $a;    # standard C type
     my long_double $c;

   Option 3: ???

   (See p6d discussion, "Numeric Types")


(B) Need to know the root of the numeric types

   Option 1:
     numeric       (mostly abstract base class)
         - num
         - int

   Option 2:

     num          (floating point 'num' is the base class)
         - int

   Option 3: ???


(C) If C-like primitives are builtin, need to know what their type 
names/aliases will be, and need to verify whether _ALL_ will have 
promoted counterparts, e.g. numeric -> Numeric, u_long -> U_Long, etc.

# (TEMPORARY) need final list of numeric types & any aliased names,
# assuming we don't want to support *all* of these names (tho we could)

# the base numeric type

numeric

# signed integers

int
int8     char
int16    short      short_int
int32    long       long_int
int64    quad       long_long    long_long_int

# unsigned integers

bit
uint     u_int
uint8    u_int8     u_char    byte
uint16   u_int16    u_short   u_short_int
uint32   u_int32    u_long    u_long_int
uint64   u_int64    u_quad    u_long_long    u_long_long_int

# floating point numbers

num     (== double)
float
double
long_double

MikeL