<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Marcel,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 12, 2019 at 2:42 AM Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div id="gmail-m_7680984557160342427__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0)">
Hi Nicolas. :-)<div><br></div><div>> <span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">What Eliot is saying is simply that we should call a spade a spade.</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Ah, right. I was wondering whether #sendsMessage: can make sense in CompiledCode or should be deprecated as Eliot suggested.</span></div></div></blockquote><div><br></div><div>Ignore the classes below. Let's look at Nicolas' definition, <font color="#000000">a message is composed of a receiver, a selector and arguments. What this translates into is that every message has a receiver expression, zero or more argument expressions and a selector. What that translates into in the bytecode of a method is a sequence of bytecodes that compute a receiver, full,owed by zero or more bytecode sequences, each of which computes an argument, followed by a send bytecode that defines which selector to include in the message. What sendsSelector: does is look at those send bytecodes and examines *only* the selector of the send. So sendsSelector: is what is going on, both conceptually and in the bytecodee search. If I constructed a message, say Message selector: #at:put: arguments: #(1 2), I could imagine a search <span style="caret-color: rgb(0, 0, 0);">function searcher sendsMe</span></font>ssage: (Message selector: #at:put: arguments: #(1 2)) that, e.g. by decompiling to a parse tree, actually found all places in the system where at: 1 put: 2 is sent. But that's an entirely different thing from finding out where the message selector at:put: is used in message sends.<br></div><div><br></div><div>There are a few places in the system where method, message nd selector are confused and the wrong name used, for example, ClassDescription>>methodsInCategory: answers the *selectors* in the category:</div><div><br></div><div><div>Object methodsInCategory: #accessing #(#at: #at:modify: #at:put: #basicAt: #basicAt:put: #basicSize #bindWithTemp: #enclosedSetElement #ifNil:ifNotNilDo: #ifNotNilDo: #ifNotNilDo:ifNil: #in: #presenter #readFromString: #size #yourself)<br></div></div><div><br></div><div>This should actually be called selectorsInCatefory: and <span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium">Object methodsInCategory: </span><font color="#000000" face="-webkit-standard" size="3"><span style="caret-color: rgb(0, 0, 0);">#accessing should answer something like</span></font></div><div>{(Object>>#at: "a CompiledMethod(4092675)") . (Object>>#at:modify: "a CompiledMethod(1648399)") . (Object>>#at:put: "a CompiledMethod(1177838)") . (Object>>#basicAt: "a CompiledMethod(2919419)") . (Object>>#basicAt:put: "a CompiledMethod(1073012)") . (Object>>#basicSize "a CompiledMethod(1528204)") . (Object>>#bindWithTemp: "a CompiledMethod(43943)") . (Object>>#enclosedSetElement "a CompiledMethod(1573905)") . (Object>>#ifNil:ifNotNilDo: "a CompiledMethod(2848834)") . (Object>>#ifNotNilDo: "a CompiledMethod(751236)") . (Object>>#ifNotNilDo:ifNil: "a CompiledMethod(1043558)") . (Object>>#in: "a CompiledMethod(3178194)") . (Object>>#presenter "a CompiledMethod(2884658)") . (Object>>#readFromString: "a CompiledMethod(3290973)") . (Object>>#size "a CompiledMethod(414933)") . (Object>>#yourself "a CompiledMethod(2905289)")}<font color="#000000" face="-webkit-standard" size="3"><span style="caret-color: rgb(0, 0, 0);"><br></span></font></div><div><br></div><div>I'm anal/OCD/obnoxious enough to find this irritating ;-) But to misquote David Byrne, names don't do what I want them to ;-)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div id="gmail-m_7680984557160342427__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0)"><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">There are the following classes in Squeak:</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Symbol</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">- can be a selector</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Message</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">- only appears via MNU?</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">- has no receiver stored because MNU callback has "self"</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">MessageSend</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">- like Message but no lookupClass</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">- has receiver stored</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">- alternative to simple BlockClosure such as [:arg | object foo: arg] </span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">CompiledCode (or CompiledMethod)</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">- has all the instructions</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">***</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Having a look at SystemNavigation >> #allSentMessagesWithout:, I wondered how to distinguish "symbol" from "selector" ... and there is also "messages" in the text. Sigh. ... some confusion going on there. :-)</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">... MethodFinder >> #findMessage ... then better called #findSelector ?! ... :-)</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Best,</span></div><div><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Marcel</span></div><div></div>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;min-width:500px">
<p style="color:rgb(170,170,170);margin-top:10px">Am 12.12.2019 11:27:49 schrieb Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div>Hi Marcel, of course you already know all this :)<br></div><div>a message is composed of a receiver, a selector and arguments.</div><div>a (Compiled)Method holds the instructions to be executed in response to a message.</div><div>The methods are stored by object class (and superclasses...) in methodDictionary.</div><div>In response to a message, the appropriate method is selected by the receiver by looking up for the message selector in methodDictionary.</div><div>The instructions consist mostly of pushing/popping objects between the stack and object slots or method args/temps, and sending messages.</div><div><br></div><div>What Eliot is saying is simply that we should call a spade a spade.</div><div>So one could expect (self sendMessage: aMessage), (self sendSelector: aSelector), but not (self sendMessage: aSelector) nor (self sendSelector: aMessage).<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 12 déc. 2019 à 09:10, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex;min-width:500px"><div><div id="gmail-m_7680984557160342427gmail-m_8645308190988709553__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0)">
Hi Eliot,<div><br></div><div>how would you define selector, message, (message) send, and method? It seems like a "message" is a very high-level concept. Selectors and methods seem to be more on the implementation side and thus the right names to use for such reflection over compiled code.</div><div><br></div><div>Project >> #addDeferredUIMessage:</div><div>CompiledCode >> #abstractBytecodeMessageAt:</div><div>SystemNavigation >> #allSentMessages</div><div>...</div><div><br></div><div>Best,</div><div>Marcel</div><div></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;min-width:500px">
<p style="color:rgb(170,170,170);margin-top:10px">Am 11.12.2019 20:50:30 schrieb <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> <<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif">A new version of Kernel was added to project The Inbox:<br><a href="http://source.squeak.org/inbox/Kernel-eem.1285.mcz" target="_blank">http://source.squeak.org/inbox/Kernel-eem.1285.mcz</a><br><br>==================== Summary ====================<br><br>Name: Kernel-eem.1285<br>Author: eem<br>Time: 11 December 2019, 11:50:19.928718 am<br>UUID: 3dce70bd-9166-47fe-a86f-22456db9845a<br>Ancestors: Kernel-mt.1284<br><br>Commit my own take on sendsSelector: vs sendsMessage:, and selectorsDo: vs messagesDo:. IMNERHO sendsMessage: messagesDo: are *wrong*!! :-) c.f. Behavior>>selectorsDo:<br><br>=============== Diff against Kernel-mt.1284 ===============<br><br>Item was changed:<br> ----- Method: CompiledCode>>messagesDo: (in category 'scanning') -----<br> messagesDo: workBlock<br>+ "Evaluate aBlock with all the message selectors sent by me. Duplicate seletors are possible."<br>- "Evaluate aBlock with all the message selectors sent by me. Duplicate sends possible."<br> <br>+ "If anything should be deprecated it is messagesDo:; it can be an extension in AST/Refactoring.<br>+ This method enumerates over selectors, not messages. c.f. Behavior>>selectorsDo: etc"<br>+ ^self selectorsDo: workBlock!<br>- | scanner selector |<br>- self isQuick ifTrue: [^ self].<br>- <br>- self codeLiteralsDo: [:compiledCode | <br>- scanner := InstructionStream on: compiledCode.<br>- scanner scanFor: [ :x | <br>- (selector := scanner selectorToSendOrSelf) == scanner<br>- ifFalse: [workBlock value: selector].<br>- false "keep scanning" ] ].!<br><br>Item was added:<br>+ ----- Method: CompiledCode>>selectorsDo: (in category 'scanning') -----<br>+ selectorsDo: workBlock<br>+ "Evaluate aBlock with all the message selectors sent by me. Duplicate seletors are possible."<br>+ <br>+ self isQuick ifTrue: [^self].<br>+ <br>+ self codeLiteralsDo:<br>+ [:compiledCode | | scanner |<br>+ (scanner := InstructionStream on: compiledCode) scanFor:<br>+ [:x| | selector |<br>+ (selector := scanner selectorToSendOrSelf) ~~ scanner ifTrue:<br>+ [workBlock value: selector].<br>+ false "keep scanning"]]!<br><br>Item was changed:<br> ----- Method: CompiledCode>>sendsMessage: (in category 'testing') -----<br>+ sendsMessage: aSelector<br>+ "eem: this should be deprecated. This method does not check if a method sends a message;<br>+ it checks if a method sends a message with a particular selector."<br>+ self flag: #todo.<br>- sendsMessage: aSelector <br>- <br> self messagesDo: [:selector |<br> selector = aSelector ifTrue: [^ true]].<br> ^ false!<br><br>Item was changed:<br> ----- Method: CompiledCode>>sendsSelector: (in category 'testing') -----<br> sendsSelector: aSelector <br>+ "Answer if the receiver sends a message whose selector is aSelector."<br> <br>+ self selectorsDo:<br>+ [:selector | selector = aSelector ifTrue: [^true]].<br>+ ^false!<br>- self flag: #todo. "mt: Deprecate? AST/Refactoring project needs it..."<br>- ^ self sendsMessage: aSelector!<br><br><br></div></blockquote>
</div></div><br>
</blockquote></div>
</div></blockquote></div><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div></div></div></div></div></div></div>