Re: Numeric Literals (Summary)
[email protected] ("Dave Whipp") Wed, 20 Nov 2002 13:35:01 -0800
| Newsgroups | perl.perl6.documentation |
|---|---|
| Organization | Fast-Chip inc. |
| Message-ID | <[email protected]> |
"Martin D Kealey" <[email protected]> wrote > I would suggest that exponent-radix should default to the same as radix. > > So > > 10:1.2.3:4.5:6 == 123450000 > 2:1:1:1110 == 0x6000 > 60:22.0.-27::-2 == 21.9925 > For some reason, I find those almost impossible to read. We have constant-propagation in the compiler (or can assume we do); and we have overloading of functions. So the following could behave like a literal: $a = num( radix=>256, digits => [ [0xff, 0b11111111] , [255, 0c377] ], exponent => 2<<16 ); assert( $a == 0xffffffff ); Anyone who wants to do something that nasty shouldn't care that it looks like a function call. Its a very rare thing to do, so it doesn't need special syntax. Dave.