[Pharo-project] 1.3 vs. 1.4
marcus.denker at inria.fr
Fri May 27 15:25:46 CEST 2011
On May 27, 2011, at 2:34 PM, Alexandre Bergel wrote:
>> 3341 use #= for integer comparison instead of #==
> I checked the issue http://code.google.com/p/pharo/issues/detail?id=3341
> but there is no explanation about the rational. Is there a technical reason to compare integer with = is better than with == ? Just wondering
This explains it more:
002788: Bug: Use of == for arithmetic equality
Description From: Dan.Ingalls at Post.Harvard.edu
Subject: Bug: Use of == for arithmetic equality
Date: 13. Februar 2006 18:37:42 GMT+01:00
To: squeak-dev at lists.squeakfoundation.org
I've been playing around with a new VM (heh, heh) which, for a while, happened not to intern (ie force unique instances of) SmallIntegers. In this case the use of == to mean arithmetic equality will not work properly. In my opinion, all such occurrences in the system should be eliminated ASAP; == is not an arithmetic compare in any Smalltalk I know of. While it may work with small constants, it is simply wrong, and an especially bad example for newbies to see. Besides failing in certain interpreters, it will fail in Squeak itself if the integers are not small.
I regret that I don't have time to fix these right now. However, if there is a well-intentioned soul out there, he or she will perhaps find the method below to be quite useful. It found 165 methods in my system with this pattern.
Marcus Denker -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-project