Puzzling code

scottw at wdi.disney.com scottw at wdi.disney.com
Wed Jul 1 16:48:01 UTC 1998

Thank you, Georg!  

About the "Rounding integers ?!?" howler:

Obviously, the intent is for this code to be the #stringForReadout implementation for Number, not for Integer!.

The error must have been caused by some mechanical editing glitch -- perhaps submitting the method in a method-list browser when the latter was pointed at a method of Integer, not Number.

Once the #stringForReadout code is placed where it belongs, in Number, you'll see that it does *not* always return the same result as #asString -- indeed the *purpose* of stringForReadout is to accommodate those cases where plain #asString is not wanted.

As for the recrudescence of #stringRepresentation -- sorry this keeps coming back!   I think I recall that your "miscChanges.st" of last year tried to remove it, but internal work being brought forward here swept it back in.  Anyway: you're absolutely right, and we'll clean this up soon.

On balance, I agree that the needs addressed by these methods are probably better served by doing special-case type-checking at the sender end rather than burdening generic classes with extra protocol.

Thanks again for your careful observations.

  -- Scott

At 6:22 AM -0700 7/1/98, Georg Gollmann wrote:
>In Squeak 2.1 there is a method
>	^ self rounded printString
>Rounding integers ?!?...
>Furthermore I believe that all implementations of 'stringForReadout' and
>'stringRepresentation' could be deleted and all corresponding message sends
>changed to 'asString'.
>Any flaws in my reasoning ?

More information about the Squeak-dev mailing list