Howdy folks!
In working on Tirade I stumbled upon SqNumberParser and its history: http://bugs.squeak.org/view.php?id=3512 ...it was added to the image in 3.9 but not hooked into Scanner - Scanned still uses Number class>>readFrom:. Now... In Tirade I can use whichever - but using SqNumberParser makes it more correct, and quite faster - although "less portable" since I would depend on it. I will now make Tirade use SqNumberParser *if present* in the image, otherwise fall back on Number class>>readFrom:. This opens up some slight potential incompatibility issues, but whatever. Question: Is there anything stopping 3.9+ including Pharo to start using SqNumberParser from Scanner>>xDigit? And oh, the class name is not so good IMHO, why the Sq prefix? And yeah, class var not used in SqNumberParser: BelllerophonBase10 :) regards, Göran |
if nicolas do it we will integrate it I imagine :)
On Mar 20, 2009, at 11:22 AM, Göran Krampe wrote: > Howdy folks! > > In working on Tirade I stumbled upon SqNumberParser and its history: > > http://bugs.squeak.org/view.php?id=3512 > > ...it was added to the image in 3.9 but not hooked into Scanner - > Scanned still uses Number class>>readFrom:. > > Now... In Tirade I can use whichever - but using SqNumberParser > makes it > more correct, and quite faster - although "less portable" since I > would > depend on it. I will now make Tirade use SqNumberParser *if present* > in > the image, otherwise fall back on Number class>>readFrom:. This > opens up > some slight potential incompatibility issues, but whatever. > > Question: Is there anything stopping 3.9+ including Pharo to start > using > SqNumberParser from Scanner>>xDigit? > > And oh, the class name is not so good IMHO, why the Sq prefix? > > And yeah, class var not used in SqNumberParser: BelllerophonBase10 :) > > regards, Göran > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > |
In reply to this post by Göran Krampe
2009/3/20 Göran Krampe <[hidden email]>:
> > 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. -- Damien Cassou http://damiencassou.seasidehosting.st |
In reply to this post by Göran Krampe
Hi again
2009/3/20 Göran Krampe <[hidden email]> Howdy folks! The history starts here http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-April/103137.html I think Diego Fernandez first proposed to use a class for parsing Numbers, but then Francisco Garau prepended a Sq (to emphasize Squeak peculiarities?) and the name remained as is... I am also equipped with a FORTRAN, a Dolphin and a VW Number parser, and guess what ? Smalltalk syntax vary... ...But I agree, Squeak Academy should discuss new names entering in the Smalltalk dictionary ;)
Yes remove it, it was used once in early days, before I correct conversions Integer>>asFloat Fraction>>asFloat (all started from here http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-April/102465.html) There is more at: http://bugs.squeak.org/view.php?id=7169 http://bugs.squeak.org/view.php?id=6779 http://bugs.squeak.org/view.php?id=7174 http://bugs.squeak.org/view.php?id=6976 http://bugs.squeak.org/view.php?id=6982
And still, one thing lacks, a proper NumberParserException... Nicolas |
In reply to this post by Damien Cassou-3
2009/3/20 Damien Cassou <[hidden email]> 2009/3/20 Göran Krampe <[hidden email]>: 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.
|
On Fri, Mar 20, 2009 at 10:52 PM, Nicolas Cellier
<[hidden email]> wrote: > 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. http://code.google.com/p/pharo/issues/detail?id=681 -- Damien Cassou http://damiencassou.seasidehosting.st |
Free forum by Nabble | Edit this page |