Re: Design Team Issues: Numeric Types
[email protected] ("Dave Whipp") Mon, 18 Nov 2002 13:33:56 -0800
| Newsgroups | perl.perl6.documentation |
|---|---|
| Organization | Fast-Chip inc. |
| Message-ID | <[email protected]> |
"Michael Lazzaro" <[email protected]> wrote > (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 Just to clarify: I think of the latter (C<range>) for efficient packing into arrays (e.g. a 5-bit range can be packed efficiently, even though there is no 5-bit c-type): binding to C routines is probably best done explicity. The C<unchecked> property would enable performance optimizations. Checked-ranges probably catch a few more bugs, though. Dave.