Is this a buglet? (SmallInteger>>printString related)

nicolas cellier ncellier at ifrance.com
Thu May 31 11:22:38 UTC 2007


Bert Freudenberg a écrit :
> On May 30, 2007, at 23:36 , goran at krampe.se wrote:
> 
>>> floorLog10bert
>>>      "from Bert Freundenberg's idea"
> 
> (My name occurrencesOf: $n) = 1 ;-)
> 

Apologies, take it as a friendly error.

>>>      (self negative or: [self isZero])
>>>          ifTrue:
>>>              [^self error: 'Can''t take log of number <= 0'].
> 
> I'd use "self < 1" for the first test to avoid unnecessary message sends 
> (and it's prettier, too).
> 

For sure, (self negative or: [self isZero]) is a stupid copy paste.
It was tailored for LargeInteger implementation for which both 
operations are trivial.
But when i think of it, LargeInteger < SmallInteger should be trivial too.
I wonder which dialect might engage a costly useless arithmetic 
operation when asked for it...

Nicolas




More information about the Squeak-dev mailing list