Aconcagua and latest pharo version

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Aconcagua and latest pharo version

hernan.wilkinson
Some Aconcagua 2.0 test fail in the latest version. The reason is related to the changes made to ScaledDecimal that now does a #coerce:
The coerce sends the message isFraction, but a Measure could be a fraction but not an instance of class Fraction, for example: 1/2 meters.
I know this could sound rare, but I think it is reasonable. That means that isFraction could respond true even though the object is not instance of Fraction.
Therefore, I had to change the #coerce: method to this:

coerce: aNumber
"Note: this quick hack could be replaced by double dispatching"
aNumber class = self class ifTrue: [^self class newFromNumber: aNumber scale: (scale max: aNumber scale)].
((aNumber class = Fraction) or: [aNumber isInteger]) ifTrue: [^self class newFromNumber: aNumber scale: scale].
^aNumber

Instead of "aNumber isFraction" now it does "aNumber class = Fraction". (I can not use isKindOf: because MeasureBagFraction is subclass of Fraction and would not work properly).

So, I do not know if it is a good idea to open a defect on this because the comment of the method says it is a quich hack... so maybe the best thing to do is for that person that is doing these changes to run also the Aconcagua test to see if everything keeps working after the changes or contact me before releasing the changes to check Aconcagua works fine.

Bye,
Hernan.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project