On Tue, Nov 19, 2002 at 10:59:02AM -0800, Michael Lazzaro wrote:
> (A) Unification of Literal <--> Stringified Numeric Behaviors
> 
> An old proposal that I can't find anymore suggested that strings should 
> be converted to a number according to the exact same rules as literals, 
> such that:
> 
>      0123   == "0123"
>      0xff   == "0xff"
>      20#1gj == "20#1gj"
>      1e10   == "1e10"
> 
> .... in the interest of regularity, flexibility, etc.  Comments?

I vote no.  The intersection of this and the rule that lets "324ewr"
be 324 is bad IMHO.  When we allow complex numbers in the mix,
we have to worry about "i" too.  I just don't like it.

> (B) We want to be able to convert strings to numbers, using strings in 
> any of the formats that literals understand.
> 
> (C) We sometimes want to be able to specify the _exact_ format a string 
> should be expected as.

I'd probably combine (B) and (C) into a single C<numify> routine:

        my $a = numify($x);
        my $b = numify($x, 'hex');  

> (D) There were proposals to allow a given string to _always_ be 
> numified in a certain way by attaching a property, e.g.:
> 
>      my str $s is formatted('%2x');
>      $s = 'ff';
>      my int $i = $s;  # 255
> 
> ....now I'm wondering if that's buying us anything, though the inverse 
> seems much more useful:
> 
>      my int $i is formatted('%4x');
>      $i = 255;
>      print $i;    # prints '00ff';
> 
> Anyone care to comment?  

I too don't see much use in the former. The latter puts distance between
the formatting and the thing being formatted and that can't be good.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to