On Sun, Aug 31, 2008 at 02:13:10AM +0200, nicolas cellier wrote:
Strangely, Squeak Number class>>#readfrom: used to accept non Smalltalk syntax like: (Number readFrom: '.2') -> 0.2 . (Number readFrom: '2.e3') -> 2000.0 .
(See http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-April/103137.htm...)
Don't know if accidental or on purpose, but to me, this is wrong and I did not implement this behavior in SqNumberParser because there is no such official Smalltalk syntax to my knowledge.
Up to any one to accept an alternate number syntax by subclassing SqNumberParser.
Now I see that Dave Lewis (dtl) asserted this feature:
testAsNumberWithSuperfluousDecimalPoint | sd | sd _ '123.s2' asNumber. self assert: ScaledDecimal == sd class. self assert: sd scale == 2. self assert: '123.00s2' = sd printString.
This originates from Mantis #156 (http://bugs.squeak.org/view.php?id=158).
I'd like to remove this feature. Is it ok?
If you change it, please change the tests to match. IIRC, the Mantis 156 patch corrected some bad problems that originated from the addition of ScaledDecimal to the system. I wrote the ScaledDecimalTest unit tests to document what I did, and I used "Smalltalk-80 The Language" as a guide where I could. I am not an expert in numerics or Smalltalk syntax, so it may not be right.
From my point of view, as long as the tests are kept up to date
with the implementation, I'll be happy.
I would suggest opening a Mantis report for the change, and tie it to Mantis 156 so folks will know the background.
Dave