Mantis - Squeak
Viewing Issue Advanced Details
6796 Kernel minor always 12-03-07 19:07 04-18-10 22:04
nicolas cellier  
nicolas cellier  
normal  
closed 3.10  
fixed  
none    
none trunk  
0006796: A ScaledDecimal is a literal but not isLiteral
self assert: 0.02s2 isLiteral.

"obviously, isn't it?"
 ScaledDecimal-isLiteral-M6796-nice-Test.1.cs [^] (1,001 bytes) 12-03-07 19:45
 ScaledDecimal-isLiteral-M6796-nice-Patch.1.cs [^] (1,105 bytes) 12-03-07 19:46

Notes
(0011506)
nicolas cellier   
12-03-07 19:10   
Hem, Ken, do i win medal for worse-behaved reporter? classify Kernel of course...
(0011507)
KenCausey   
12-03-07 19:35   
You are working hard at it at least. ;)
(0011508)
nicolas cellier   
12-03-07 19:54   
Less obvious is (1/3.00s2). Since ScaledDecimal retain infinite precision, it cannot store literaly but with an infinite number of digits.

So it would not make a good literal.
I propose in test and patch that it answer false for this reason.

Note that this is connected to 0004378 and 0006482.
So a better patch to 0004378 could now use isLiteral test...
(0011511)
nicolas cellier   
12-03-07 21:32   
However, just thought of this one: 0.001s1 can be represented as a literal, but won't print as isSelfEvaluating... (it will print '0.0s1')

This is tricky.
(0011515)
nicolas cellier   
12-04-07 09:27   
Since Squeak accept ScaledDecimals literals input in other bases, (1/3.0s2) has a literal representation finally:

    3r0.10s2

We can print up to base 36... meaning we can represent denominators that can be decomposed in the form a1^n1 * ... * ap^np
where (a1...aP) tuple can be any of (0) (1) (2) (3) (5) (2,3) (7) (2,5) (11) (13) (2,7) (3,5) (17) (19) (3,7) (2,11) (23) (2,13) (29) (2,3,5) (31) (3,11) (2,17) (5,7)

Well, sure that's not really original meaning of deci-mal...
(0011561)
Keith_Hodges   
12-17-07 16:51   
"fix begin"
Installer mantis bug: 6796 fix:'ScaledDecimal-isLiteral-M6796-nice-Patch.1.cs'.
"fix test"
Installer mantis bug: 6796 fix:'ScaledDecimal-isLiteral-M6796-nice-Test.1.cs'.
"fix end"

(0013301)
nicolas cellier   
09-12-09 20:11   
This appears to be already fixed in trunk, don't know exactly in which .mcz