<div dir="ltr">Hi rabbit,<div><br></div><div>Traits are used by classes, not by instances, but traits can supply methods both to the instance side and the class side. If you use a trait in a class, the trait's methods are copied to the MethodDictionary of that class (and the corresponding classTrait methods go to the dictionary of the corresponding Metaclass). If you then change the method on the trait, it will automatically update those method copies in the using classes. When you send a message that the trait method can handle to an object of the class that uses the trait, it will run its copy of the trait method—just like the method dictionary/lookup usually works. When you implement your own method in the class, even though that method would also be provided by a trait that the class uses, the trait will skip that method and leave your own method in place.</div><div><br></div><div>Now whether traits could help you depends on how you implemented erefs and do the Smalltalk message processing. If you want a dynamic, instance-specific display in the protocol browser (or rather InstanceBrowser), at the first glance it does not sound to me like traits would be a fit. If you can derive the methods just from the reference to the remote class, you should better override those messages that the browser sends to determine which methods there are in your eref class. Or implement a custom browser that sends different messages to collect that information.<br><div><br></div><div>Since Java 8, interfaces can provide "default" implementations of methods, which allows you to use them for the same purpose as you can use traits in Smalltalk. Up to Java 7, interfaces could only declare methods, but not provide an implementation. And since we do not use static typing in Smalltalk, that original functionality of interfaces is unnecessary in Smalltalk: we do not have to declare in advance which messages the class understands. So since traits exist to provide implementations, not specify interfaces, they are rather the complementary functionality to what Java interfaces originally were.</div><div><br></div><div>Kind regards,<br>Jakob</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am So., 9. Okt. 2022 um 08:34 Uhr schrieb rabbit <<a href="mailto:rabbit@callistohouse.org">rabbit@callistohouse.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Currently inspecting and selecting an eventual ref blows up the image. The cause is unknown. Selecting ‘all inst variables’ does not. I’ll need to look 👀 into this. <div><br></div><div>An eref references a remote class, so if an eref needs to display in the browser the protocol for that class. Can a class trait be attached to an instance to allow this? Will the trait means calls to a method on that classTrait runs that method? Is there a way to have a classTrait to provide the message interface without the methods being implemented on that eref, such that those classTrait protocol methods get forwarded to the eventualeé?</div><div><div dir="ltr"><br></div><div dir="ltr">I know so little about Traits! Are they similar to Java’s interfaces?</div><div dir="ltr"><br><div><div id="m_-14366136446897650protonmail_signature_block" style="outline:none"><div style="outline:none"><div style="outline:none"><span style="background-color:rgba(255,255,255,0)">Have a good one; keep it, light.</span></div><div style="outline:none"><span style="background-color:rgba(255,255,255,0)">Kindly,<br></span></div><span style="background-color:rgba(255,255,255,0)">rabbit<br>. .. … ‘…^,^</span></div></div><div style="outline:none"><span style="background-color:rgba(255,255,255,0)"><br></span></div><div style="outline:none"><span style="background-color:rgba(255,255,255,0)"><br></span></div><div id="m_-14366136446897650protonmail_mobile_signature_block" style="outline:none;min-height:40px"><div style="outline:none"><span style="background-color:rgba(255,255,255,0)">Sent from Callisto House Mobile :: decentralized mobile homeless solutions</span></div><div style="outline:none"><span style="background-color:rgba(255,255,255,0)"><br></span></div><div style="outline:none"><pre id="m_-14366136446897650tw-target-text" dir="ltr" style="line-height:32px;border:none;padding:10px 0.14em 10px 0px;overflow:hidden;width:343px"><span lang="de" style="white-space:normal;background-color:rgba(255,255,255,0)"><font face="UICTFontTextStyleBody">Der Anführer kontrolliert alles,</font></span></pre><pre id="m_-14366136446897650tw-target-text" dir="ltr" style="line-height:32px;border:none;padding:10px 0.14em 10px 0px;overflow:hidden;width:343px"><span lang="de" style="white-space:normal;background-color:rgba(255,255,255,0)"><font face="UICTFontTextStyleBody">🐇🐇🐇🐇🐇🐇</font></span></pre></div></div></div></div></div></div><br>
</blockquote></div>