<div dir="ltr"><div dir="ltr"></div>Juan,<div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 30, 2019 at 11:43 PM Juan Vuletich via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div bgcolor="#ffffff">
Hi Nicolas,<br>
<br>
On 9/30/2019 8:36 PM, Nicolas Cellier via Cuis-dev wrote:
<blockquote type="cite">
<div dir="auto">
<div>Hi Juan,</div>
<div dir="auto">Something strikes me.</div>
<div dir="auto">Isn't this example a pathological case of
inheritance? Is Color really kind of Collection? Wouldn't any
object potentially be a collection of its instances variables
in this case?<br></div></div></blockquote></div></blockquote><div><br></div><div>Well that kind of gets to a core issue (in an abstract way... I know, your favorite ;-) in that there is nothing inherent about being a Color that one should reasonably expect it to behave as a collection. Sending #collect: etc. on a Color from an outside object doesn't actually make a lot of sense other than to abuse a leaked implementation detail (i.e. that it's actually implemented as a collection.)</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#ffffff"><blockquote type="cite"><div dir="auto"><div dir="auto">
</div>
</div>
</blockquote>
<br>
It can be considered a space optimization. Just like Squeak's
encoding of RGB in a SmallInteger. Other examples in Cuis packages
include Float32Matrix3x3, Float32Vector3, Float64Matrix?x?,
Float64Quaternion, Float64Vector?, GPSPosition, All these could use
ivars, but dont, and inherit from FloatArray or Float64Array.<br></div></blockquote><div><br></div><div>There are FFI reasons as well. (but that's an implementation detail)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#ffffff">This makes sense especially on 64 bit images for objects whose parts
can be 32bit or shorter immediates, and if we build many instances.
In this cases, I think the space saving overwheights the
inconvenience of not having real ivars.<br></div></blockquote><div><br></div><div>One could argue (and I am) that whether it was implemented it that way for space savings or other reasons that we shouldn't depend on it being a collection because you could just as easily re-implement it as a direct subclass of Object and it would still make sense. The fact that it is currently a collection seems irrelevant to being a Color. The fact that it would no longer responded to #collect: and friends wouldn't make it any less a Color... so why encourage/support using these (essentially) leaked methods externally?</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#ffffff"><pre cols="72">--
Juan Vuletich
<a href="http://www.cuis-smalltalk.org" target="_blank">www.cuis-smalltalk.org</a>
<a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a href="https://github.com/jvuletich" target="_blank">https://github.com/jvuletich</a>
<a href="https://www.linkedin.com/in/juan-vuletich-75611b3" target="_blank">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre></div></blockquote><div><br></div><div>Thanks,</div><div>Phil </div></div></div></div>