[squeak-dev] a transitive law broken by Fraction since 5.3
Chris Muller
ma.chris.m at gmail.com
Fri Dec 31 00:29:37 UTC 2021
__________
*“If a is equal to b and b is equal to c, then a is equal to c.”*
__________
| a b c |
a := Fraction numerator: 5 denominator: 1.
b := 5.0.
c := 5.
self assert: a=b; assert: b=c. "Pass"
self assert: a=c. "Fail"
__________
I understand this is not a normal way to create Fractions, but serializers
must often construct objects in other-than-normal ways. This constructor
on Fraction is actually a valid API, but leaves an inconsistent comparison
contract with other Numbers.
I fixed it by reverting Fraction>>#= to the (nice 3/28/2006 23:41) edition.
Comments?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211230/d6cab2e4/attachment.html>
More information about the Squeak-dev
mailing list
|