<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p>(Separate idea, separate post:)</p>
<p><br>
</p>
<p>The main (may I say the only?) use case of ProtoObject is to have a minimum superclass for generic proxies or decorators that are implemented generically using #doesNotUnderstand:.</p>
<p>Besides this mechanism, we also have #run:with:in: (see ObjectsAsMethodsExample).</p>
<p>Would it, hypothetically spoken, be worth a thought to implement some kind of hook on VM side/code simulation that is called before sending any message to a new receiver? Very pseudo:</p>
<p><br>
</p>
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p>MyCoolProxy >> #unmanagedPerformMessage: aMessage</p>
</div>
<div style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p>    "by implementing this method on a class, you tell the engine to call it before sending any message from a different object to the receiver</p>
<p>    (we could also use something like #flush for this)"</p>
</div>
<div style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p>    aMessage = #inspectorClass ifTrue: [</p>
</div>
<div style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p>        ^ aMessage sentTo: self "don't forward this message"].</p>
<p>    self log: aMessage. "sending a message to the receiver does not invoke #unmanagedPerformMessage:"</p>
<p>    "Finally ..."</p>
</div>
<div style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p>    <span style="font-size: 12pt;">^ aMessage sentTo: myTarget</span></p>
</div>
</blockquote>
<div style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p><span style="font-size: 12pt;"></span></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="_rp_T4" id="Item.MessagePartBody">
<div class="_rp_U4 ms-font-weight-regular ms-font-color-neutralDark rpHighlightAllClass rpHighlightBodyClass" id="Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
<div class="_rp_T4" id="Item.MessagePartBody"><br>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">Probably there is at least one very good reason not to implement this, besides confusion and (maybe?) performance. But I would be delighted to hear this reason :-)</div>
<div class="_rp_T4" id="Item.MessagePartBody"><br>
</div>
<div class="_rp_T4" id="Item.MessagePartBody">Best,</div>
<div class="_rp_T4" id="Item.MessagePartBody">Christoph</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Thiede, Christoph<br>
<b>Gesendet:</b> Freitag, 14. Februar 2020 14:18 Uhr<br>
<b>An:</b> Squeak Dev<br>
<b>Betreff:</b> [squeak-dev] [Bug & design issue] Messages understood or not understood by ProtoObject</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p>Hi all! :-)</p>
<p>When we were fiddling around with some proxy implementations today, Marcel and I discovered an interesting set of issues regarding ProtoObjects.</p>
<p>Let's start with a concrete bug:</p>
<p><br>
</p>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<p><b>Code to reproduce <do it>:</b></p>
<p>ProtoObject new class.</p>
<p><br>
</p>
<p><b>Expected behavior:</b></p>
<p>DNU exception, because #class is implemented on Object only.</p>
<p><br>
</p>
<p><b>Actual behavior:</b></p>
<p>Outputs ProtoObject.</p>
<p>Even stranger: If you debug the method instead and simulate the #class send, you get a "simulated message class not understood" error.</p>
<p>If you subclass ProtoObject and override/forward #class, the results will deviate based on whether you are debugging or executing the code.</p>
</blockquote>
<p><br>
</p>
<p><b>Some thoughts:</b></p>
<p><span style="font-size:12pt">There are two options: Either to implement #class on ProtoObject (by </span><span style="font-size:12pt">moving the primitive definition up from Object</span><span style="font-size:12pt">), or to </span><span style="font-size:12pt">remove
 it from the specialObjectsArray so that a send to #class is not compiled differently than a send to any other regular message.</span><br>
</p>
<p><span style="font-size:12pt"><br>
</span></p>
<p>This leads us to the rather general question: <b>What special messages should an instance of ProtoObject understand?</b></p>
<p>We don't answer this question completely consistent at the moment: For example, #instVarAt: is implemented on Object, but #instVarsInclude: is implemented on ProtoObject. Again, it is a bit weird that the implementation of #instVarsInclude: calls #class
 which is implemented on Object only. And so it goes on:</p>
<p></p>
<ul style="margin-bottom:0px; margin-top:0px">
<li>#someObject is implemented on Object, but #nextObject is available in ProtoObject.</li><li>#withArgs:executeMethod: is implemented on ProtoObject, whereas #perform:withArguments: is on Object.</li><li>#ifNotNil: is implemented on ProtoObject; however, #ifNotNilDo: is implemented on Object. (btw: does the latter still have any <span>raison d'être?)</span></li><li><span>#flag: exists on ProtoObject, and #yourself exists on Object only. Isn't #yourself rather a syntactical element we would like to behave exactly the same way for every possible message receiver? (btw: Is there a good reason not to speed up #yourself
 via specialObjectsArray)?</span></li><li><span>(I don't claim for completeness)</span></li></ul>
<div><br>
</div>
<div>And just some other problems regarding to ProtoObject (just collecting them here instead of forgetting them forever):</div>
<div>
<ul style="margin-bottom:0px; margin-top:0px">
<li><span>ObjectTracer is broken due to several reasons. Will fix this soon.</span><br>
</li><li><span>Inspectors cannot inspect ProtoObjects correctly (for example: <span>Inspector openOn: (ObjectTracer on: Display)). This is because #instVarAt: is implemented on Object only so this message is forwarded.<br>
Maybe we should replace these critical calls from Inspector by something like #tryPrimitive:173withArgs:? But should we do so in Inspector or rather in a new subclass named ProtoInspector or similar? Hm, then we would need to implement #inspectorClass on ProtoObject,
 which is bad either ... We will keep investigating this issue.</span></span></li></ul>
<div><br>
</div>
</div>
<div>However, the crucial question is: What special messages should an instance of ProtoObject understand? On the one hand, the idea of ProtoObjects is to work as total proxies with a maximum amount of forwarding potential, which implies a minimum number of
 methods. On the other hand, certain aspects such as accessing instvars or executing messages are really identity-related. <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">Looking
 forward to your comments :-)</span></div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
<p></p>
<p></p>
<p><span></span></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>