Fraction hackers...
Bert Freudenberg
bert at isgnw.CS.Uni-Magdeburg.De
Fri Sep 10 14:26:00 UTC 1999
On Fri, 10 Sep 1999, Florin Mateoc wrote:
> Well, guess what:
>
> '(1/2)' + 0.5 breaks
> (1/2) + '0.5' 1.0
>
> '(1/2)' * 0.5 breaks
> (1/2) * '0.5' 0.25
>
> and so on...
So what? The point is, #= does not mean arithmetic equality in Smalltalk
(though for Numbers, and only Numbers, it is equivalent). Besides, I'm no
fan of String arithmetics either. It's a nice example of polymorphism and
the double-dispatched-cooercion-mechanism, though ;-)
> Plus , between
> '(1/2)' = 0.5 "false"
> (1/2) = '0.5' "true"
> IMHO the second result is "truer" than the first one, so maybe we
> should fix the first one instead of falsifying the second one if we care for
> simmetry (I agree, simmetry is good)
That would lead to the following: If (a = b) and (b = c) then (a = c),
right? So from ('3' = 3) and (3 = '3.0') follows ('3' = '3.0')?
That breaks the rule that two collections are equal if their elements are
equal!
(I think you take the interpretation for the actual contents - to the
computer a string is just a collection of characters, and we shoudn't try
to tell him/her otherwise...)
> I am also sure that simmetry is broken for #= in other cases as
> well, but I'll have to check.
If you find some, please report them as bugs.
> As for #reduced I agree with both Bert (#reduce would be better) and
> Leandro (it should have been = instead of ==)
Thanks ;-)
/bert
More information about the Squeak-dev
mailing list
|