On Thu, Oct 11, 2001 at 10:28:34AM -0500, Jonathan Scott Duff wrote: > On Thu, Oct 11, 2001 at 11:13:59AM -0400, Dan Sugalski wrote: > > As for more complex string literals evaluating to numbers, I think that's > > something best left to either a user-written sub, or user-written fancy > > parser hacks. Up to Larry whether it goes in the base language, but I think > > I'd prefer not. > > Speaking of string turning into numbers ... > > It's bothered me that I can write 100_000 in my perl code, but if I have > a string "100_000" it'll evaluate to 100 when numerified. It would be > really weird if "10indigo" became 10i, "1e3foobar" became 1000, and > "10_000" became 10 in Perl 6 IMHO.
Perl's been very consistent in not handling strange things in its string-to-number conversion because of the god-awful string processing code that a lot of people have to write to handle stupid file formats. For example, zero-filled numbers are not converted to octal because many text files contain zero-filled numbers. The idea that "0cat" is "0", but "0xat" is 10 will confuse a lot of folk. If strings in numeric context are treated the same way as the parser would, then I think there need to be warnings for trailing garbage. No, I think if you want "10_000" to be 10000, you can always eval it, but I don't think anyone reading in text should expect that. -- Aaron Sherman [EMAIL PROTECTED] finger [EMAIL PROTECTED] for GPG info. Fingerprint: www.ajs.com/~ajs 6DC1 F67A B9FB 2FBA D04C 619E FC35 5713 2676 CEAF "Write your letters in the sand for the day I'll take your hand In the land that our grandchildren knew." -Queen/_'39_