The two problems were identified from the beginning:

1) 2.e5 and .2 did work in old squeak images, but no more with SqNumberParser
Rationale: SqNumberParser is for parsing number literals in squeak
syntax, and those extensions are not identified squeak syntax

If you need these syntax, the best thing is to subclass the
NumberParser. For example, I must have a FORTRANNumberParser available
somewhere...

2) Silently returning zero in case of error.
This was one of the goal of SqNumberParser: let programmer choose the
appropriate behaviour
- raise an Exception
- answer nil
- answer a default value (zero)
The last solution has been connected to Number class>>#readFrom: for
historical compatibility reasons.
I agree this conservative choice was unfortunate.
Pharo should not fear and break compatibility on such dumb behaviours.

Nicolas

2009/9/24 Stéphane Ducasse <[email protected]>:
> I imagine that nicolas will let us know.
> If you have tests we would love to integrate them so that we can
> detect that.
>
> Stef
>
> On Sep 23, 2009, at 11:25 PM, John M McIntosh wrote:
>
>> I noticed that in Squeak and earlier version of Pharo doing
>> '.2e2' asNumber
>> would return 20.0
>> or '.2' asNumber
>> would return 0.2
>>
>> but currently in Pharo those return 0, without error, comment, or
>> other hand waving.
>> Good thing I have Sunits...
>>
>> So is this a bug or feature?
>>
>> Hint obviously in the Fractions calculator people are lazy and enter .
>> 2e2 or .2 without the leading zero...
>>
>> --
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> John M. McIntosh <[email protected]>   Twitter:
>> squeaker68882
>> Corporate Smalltalk Consulting Ltd.  http://
>> www.smalltalkconsulting.com
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>>
>>
>>
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [email protected]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to