SYSTEM WARNING: Creating default object from empty value

Mantis - Squeak
Viewing Issue Advanced Details
4378 Kernel minor always 08-04-06 01:15 04-18-10 22:05
nicolas cellier  
andreas  
normal  
closed 3.9  
fixed  
none    
none trunk  
0004378: ScaledDecimal storeString incorrectly use printOn: and loose exactness
"Both results should be 1.
ScaledDecimal representations are exact
(though only scale digits or fractional part are printed)"

self assert:
    (Compiler evaluate: (0.5s1 squared storeString)) * 4
    = (0.5s1 squared * 4)
I signalled the bug to vwnc list and it was suggested to store as
1 / 4.0s1

storeString should be something like
('(' , faction numerator storeString , '/' , (fraction denominator storeString) , 's' , scale storeString , ')')

storeOn: aStream
  aStream
    nextPut: $(;
    store: fraction numerator;
    nextPut: $/;
    store: fraction denominator;
    nextPut: $s;
    store: scale;
    nextPut: $)
related to 0006696assigned andreas ScaledDecimal can read in base 16 but cannot print in base 16 
related to 0006482closed andreas [BUG] Interval storeOn: incorrect for some ScaledDecimal 
 ScaledDecimal-storeOn-Test.1.cs [^] (457 bytes) 05-11-07 22:30
 ScaledDecimal-storeOn-Patch.1.cs [^] (394 bytes) 05-11-07 22:30
 ScaledDecimal-storeOn-M4378-nice-Patch.2.cs [^] (771 bytes) 12-03-07 20:10
 ScaledDecimal-storeOn-M4378-nice-Patch.3.cs [^] (938 bytes) 12-03-07 20:20
 ScaledDecimal-storeOn-M4378-Test.2.cs [^] (1,208 bytes) 12-03-07 20:35

Notes
(0010706)
nicolas cellier   
05-11-07 22:24   
Even if store patch is applied, a lot of methods implicitly rely on Number printOn: can be used in place of storeOn:

Example of wrong code:
    | interval1 interval2 |
    interval1 := (0 to: 1 by: 0.5s1 squared).
    interval2 := Compiler evaluate: interval1 storeString.
    {interval1 size. interval2 size}
will answer "#(5 6)"
(0011509)
nicolas cellier   
12-03-07 20:09   
Ah, first patch could break some decompiler tests because ScaledDecimal would not storeOn: literaly.

A better patch is Patch.3.cs but it requires prerequisite patch from 0006796

(don't bother with Patch.2.cs, i forgot to accept the method)

(0011562)
Keith_Hodges   
12-17-07 16:55   
"fix begin"
Installer mantis ensureFix: '6796 A ScaledDecimal is a literal but not isLiteral'.
Installer mantis bug: 4378 fix:'ScaledDecimal-storeOn-M4378-nice-Patch.3.cs'.
"fix test"
Installer mantis bug: 4378 fix:'ScaledDecimal-storeOn-M4378-Test.2.cs'.
"fix end"

(0013282)
nicolas cellier   
08-24-09 20:20   
Fixed in http://source.squeak.org/trunk/Kernel-nice.204.mcz [^]