On 27 September 2010 11:54, Johan Brichau <jo...@inceptive.be> wrote:
>
> On 27 Sep 2010, at 10:38, Lukas Renggli wrote:
>
>>> Am I wrong?
>>
>> Yes, almost always one should probably use #= instead of #==.
>
> I will add that to the exercise :-)
> The exercise actually makes students aware of the difference between strings 
> and symbols (which should be pointer-equal)
>

I think you can avoid using 'equal' word when describing a #== comparison.
It can be explained as 'test whether comparands are same object or not'
while #= is test whether two objects equal or not.

Also keep in mind that #== optimized by compiler. So , even if you
override it in some class,
it won't behave differently.

And #=, of course, can be implemented in any way you like. One of
interesting example:

= anObject
 ^ false

saying 'i am not equal to anything' :)


> Johan
> _______________________________________________
> Pharo-project mailing list
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to