[Pharo-project] Issue 3348 in pharo: use #shouldBePrintedAsLiteral instead of #isLiteral when printing or storing characters and arrays

pharo at googlecode.com pharo at googlecode.com
Sat Nov 27 18:30:34 CET 2010


Comment #1 on issue 3348 by stephane.ducasse: use #shouldBePrintedAsLiteral  
instead of #isLiteral when printing or storing characters and arrays
http://code.google.com/p/pharo/issues/detail?id=3348

- introduced Object >> #shouldBePrintedAsLiteral as a replacement for  
#isLiteral during printing and storing

=============== Diff against Kernel-dtl.517 ===============

Item was added:
+ ----- Method: Object>>shouldBePrintedAsLiteral (in category 'testing')  
-----
+ shouldBePrintedAsLiteral
+
+       ^self isLiteral!

Item was changed:
  ----- Method: ScaledDecimal>>storeOn: (in category 'printing') -----
  storeOn: aStream
        "SxaledDecimal sometimes have more digits than they print  
(potentially an infinity).
        In this case, do not use printOn: because it would loose some extra  
digits"

+       self shouldBePrintedAsLiteral
-       self isLiteral
                ifTrue: [self printOn: aStream]
                ifFalse: [aStream
                        nextPut: $(;
                        store: fraction numerator;
                        nextPut: $/;
                        store: fraction denominator;
                        nextPut: $s;
                        store: scale;
                        nextPut: $)]!





More information about the Pharo-project mailing list