[squeak-dev] SqNumberParser!

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Fri Mar 20 21:52:22 UTC 2009


2009/3/20 Damien Cassou <damien.cassou at gmail.com>

> 2009/3/20 Göran Krampe <goran at krampe.se>:
> >
> > Question: Is there anything stopping 3.9+ including Pharo to start using
> > SqNumberParser from Scanner>>xDigit?
>
> IIRC the only problem is with parsing non numbers like 'abc'.
> #readFrom: returns 0 whereas SqNumberParser throws an exception.
>

Sure, but if compatibilty counts, it would be very easy to implement
Number class>>readFrom: aStream
    ^SqNumberParser: parse: aStream ifFail: [^0]

Apart a few weird edge cases, it would be roughly the same...
... just more exact (round to nearest Float) and faster.


> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090320/3969826d/attachment.htm


More information about the Squeak-dev mailing list