<div dir="ltr"><div>Hi Chris.</div><div><br></div>Just for notice in Pharo #class is a normal message send for a long time. I wonder that it is not true for Squeak.   <div><br></div></div><br><div class="gmail_quote"><div dir="ltr">чт, 22 нояб. 2018 г. в 17:21, Chris Muller <<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi guys,<br>
<br>
Something I've been wanting to ask the community for years, but never<br>
had the gumption, was about changing how we write our #= and #hash<br>
methods, but now that we're combing through them anyway, I must!<br>
<br>
Basically, it comes down to Proxy's.  I want them to work better in<br>
Squeak.  But every time we put another send to #class or #== in an<br>
implementation of #=, since those methods are inlined, they're too<br>
brittle to work with Proxy's.  This causes hard-to-trackdown bugs in<br>
applications and mini-messes to deal with them since the app is forced<br>
to change its code to become "aware" of potential Proxy'iness of an<br>
object before comparing it with #=.<br>
<br>
This is no surprise, since writing a send to #== instead of #= for no<br>
more than "performance" is actually breaking encapsulation in the<br>
first place...<br>
<br>
There is an easy solution.  When writing #= and #hash implementations,<br>
use (#species or #xxxClass or #isKindOf: instead of #class) and #=<br>
instead #==.  So, for example, Eliot, I want to upgrade your new<br>
Message>>#= to something like:<br>
<br>
= anObject<br>
    ^self xxxClass = anObject xxxClass<br>
      and: [selector = anObject selector "selector lookup is by identity"<br>
      and: [lookupClass = anObject lookupClass<br>
      and: [args literalEqual: anObject arguments]]]<br>
<br>
Or #species or #isKindOf:, like we do in many other methods.  Now the<br>
method is Proxy-compatible.<br>
<br>
What do you think?<br>
<br>
</blockquote></div>