<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:large">Hi Christoph,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 1, 2020 at 10:51 AM Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.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>

<div id="gmail-m_-3204885043950614939divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi Eliot,</p>
<p>I'm not deep in this stuff, but I always try to keep maximum flexibility in terms of polymorphy when designing any interface in Squeak. Thus my naive choice would be option 3, <span>ignore it and hope the user knows what they're doing. Using of #isKindOf:
 etc. often can lead to problems, for example, imagine an association being wrapped within a proxy or an ObjectTracer ... </span><span style="font-size:12pt">Just my 2 cents :)</span></p></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:large">Well, it's easy to put checking in for EphemeronDictionary, because there things really matter. (& thx for your real-time response ;-) )</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">In looking at the code it strikes me that arrayClass should also be implemented on the instance size to match associationClass.  This affects only OrderedCollection new which sends arrayClass form the class side; all other sends are instance size.  And that's easy to deal with:</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:large"><font face="times new roman, serif"><span style="color:rgb(0,0,0);font-size:medium">OrderedCollection class>>#</span>new: anInteger </font></div><div class="gmail_default" style="font-size:large"><font face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>^ self basicNew setCollection: (self arrayType new: anInteger)</font></div><div class="gmail_default" style="font-size:large">=></div><div class="gmail_default"><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)"><font face="times new roman, serif"><span style="font-size:medium">OrderedCollection class>>#</span>new: anInteger </font></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="font-family:"times new roman",serif;white-space:pre">   </span><span style="font-family:"times new roman",serif">| instance |</span></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)"><font face="times new roman, serif"></font></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="font-family:"times new roman",serif;white-space:pre">      </span><span style="font-family:"times new roman",serif">^(instance := self basicNew) setCollection: (instance arrayType new: anInteger)</span></div><div class="gmail_default" style="color:rgb(0,0,0)"><font face="arial, sans-serif" size="4"><br></font></div><div class="gmail_default" style="color:rgb(0,0,0)"><font face="arial, sans-serif" size="4">Any objections?</font></div></div></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><div id="gmail-m_-3204885043950614939divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p><span style="font-size:12pt">Best,</span><br></p>
<p><span style="font-size:12pt">Christoph</span></p>
<div id="gmail-m_-3204885043950614939Signature">
<div id="gmail-m_-3204885043950614939divtagdefaultwrapper" 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">
<div>
<div id="gmail-m_-3204885043950614939Item.MessagePartBody">
<div id="gmail-m_-3204885043950614939Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="gmail-m_-3204885043950614939divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="gmail-m_-3204885043950614939Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont">
<div><font size="3" color="black"><span style="font-size:12pt"><a href="http://www.hpi.de/" rel="noopener noreferrer" id="gmail-m_-3204885043950614939LPNoLP" target="_blank"><font size="2"><span id="gmail-m_-3204885043950614939LPlnk909538"><font color="#757B80"></font></span></font></a></span></font></div>
</font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-3204885043950614939divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>><br>
<b>Gesendet:</b> Donnerstag, 1. Oktober 2020 19:44:46<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> [squeak-dev] Ephemerons and Dictionaries</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div style="font-size:large">Hi All,</div>
<div style="font-size:large"><br>
</div>
<div><font size="4">    to be able to ease </font>EphemeronDicitonary<font size="4"> into the system easily I'd like to clean up adding associations to Dictionary.  It seems to me there's a partial implementation of choosing an association
 class appropriate for a dictionary in the </font>implementors<font size="4"> of associationClass: Dictionary>>#associationClass, WeakKeyDictionary>>#associationClass, WeakValueDictionary>>#associationClass, (& in my image STON class>>#associationClass).  This
 seems workable; an EphemeronDictionary would simply add </font><span style="font-size:medium;color:rgb(0,0,0);font-family:-webkit-standard">associationClass ^ Ephemeron</span><span style="color:rgb(0,0,0)"><font face="arial, sans-serif">
<font size="4">and we're done, except not quite...</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4"><br>
</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4">First, HashedCollection does not use associationClass, but it implements atNewIndex:put: and it strikes me that atNewIndex:put: for Dictionary really should
 check for the thing being added at least includingBehavior: self associationClass.  So that means Dictionary should override atNewIndex:put:.</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4"><br>
</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4">But what should happen in atNewIndex:put: if the object being added isn't appropriate?  Do we</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4">- raise an error? (that's my preference, but I've got limited use cases in my head)</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4">- replace the association with one of assocationClass? (seems dangerous to me but maybe someone needs this or the existing system does this anyway)</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4">- ignore it and hope the user knows what they're doing?</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4"><br>
</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4"><br>
</font></font></span></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif"><font size="4"><br>
</font></font></span></div>
<div dir="ltr">
<div dir="ltr">
<div><span style="border-collapse:separate"><font size="4">
<div>_,,,^..^,,,_<br>
</div>
<div>best, Eliot</div>
</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</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>