On Tue, Mar 15, 2005 at 10:34:04AM -0500, Aaron Sherman wrote:
> On Tue, 2005-03-15 at 10:09, Autrijus Tang wrote:
> > Currently Pugs numifies hexadecimal and octal strings as if they
> > are literals; that means "0x123" and "0o456" all work as expected.
> > Is that an acceptable treatment? What about "Inf" and "NaN" in
> > numeric context?
> 
> This has long been a point of contention in Perl 5.
> 
> There are two camps when it comes to how to interpret strings as
> numbers:
> 
>      1. You must treat them the same for consistency.
>      2. You must not treat them the same because someone reading in
>         lines of a report like the following could be seriously shocked
>         by the behavior:
>                   $ Book
>                    5foundation
>                    8rama
>                    0xanth

They may also be shocked if their data happens to have a line like the
following:

                     3e2-home

That particular configuration is also rarer and therefore more likely
to surprise if the programmer isn't aware.  

I think that perl should auto-numify but not recognize hex, octal, or
even scientific notation without some explicit conversion.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to