On May 27, 2011, at 2:34 PM, Alexandre Bergel wrote: >> 3341 use #= for integer comparison instead of #== > > > Hi! > > 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: http://bugs.squeak.org/view.php?id=2788 002788: Bug: Use of == for arithmetic equality Description From: [email protected] Subject: Bug: Use of == for arithmetic equality Date: 13. Februar 2006 18:37:42 GMT+01:00 To: [email protected] 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.
