[squeak-dev] Using #= for integer comparison instead of #==
Juan Vuletich
juan at jvuletich.org
Tue Nov 16 12:37:57 UTC 2010
Hi Levente,
Levente Uzonyi wrote:
> Hi,
>
> I'm mostly ready with this cleanup, only a few methods left in the
> image that use #== for integer comparison. Some of them must use #==,
> others may be changed, but I wasn't sure if the code will work if it's
> changed or not. If you'd like to check these methods, then evaluate
> the following in a workspace:
>
> ... code here...
>
> Cheers,
> Levente
Thanks for the snippet! It is now a method in Cuis. I also checked a bit
on trunk. In all senders of #nextObject you can apply the pattern in
#allObjectsDo:. Instead of assuming == 0 for last #nextObject, it
assumes that Object new will go at the end. If that ever changed, a few
places would need fixing...
As an experiment, in #allObjectsDo: I tried to remove the Object new
stuff and replace with '[ 0 = object and: [ object isMemberOf:
SmallInteger ]] whileFalse: ', but my test became extremely slow. I
suspect #= is sending the message even if it has its own bytecode... So,
the only method that remains with the '0 ==' pattern in Cuis is
#critical:ifLocked: , as I'm not sure if we can clean it.
Cheers,
Juan Vuletich
More information about the Squeak-dev
mailing list
|