Re: [Fwd: Re: Numeric Literals (Summary)]

[email protected] (Dave Whipp) Fri, 15 Nov 2002 00:51:21 -0800
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
Richard Nuttall wrote:

> How about
> 
> my $a = 256:192.169.34.76;
> my $b = $a.base(10);
> my $c = '34:13.23.0.1.23.45'.base(16);

This coupling makes me nervous. A number is a number: its value is not 
effected by its representation.

I can see that, in some scripts, it might be useful to define a property 
such that:

my $a = 26 but string_fmt("%02x"); # == ("%16.02r")
print $a, "$a", ~$a, sprintf("%s", +$a);

would print "26 1a 1a 26" (without the spaces).

However, I would not like to see such a property set by default. It has 
the potential to cause too many surprises for the unsuspecting recipient
of a number, who suddenly finds it behaves in funny ways.


Dave.