<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Folks,<br>
<br>
(below)<br>
<br>
On 10/1/2019 1:25 AM, Phil B wrote:
<blockquote
cite="mid:CAMJMOej4RJwjOz6gkxToqHrQid97O4BQog95dLLnpfG=TgntDg@mail.gmail.com"
type="cite">
<div dir="ltr">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
moz-do-not-send="true"
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;">
<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 moz-do-not-send="true" href="http://www.cuis-smalltalk.org" target="_blank">www.cuis-smalltalk.org</a>
<a moz-do-not-send="true" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a moz-do-not-send="true" href="https://github.com/jvuletich" target="_blank">https://github.com/jvuletich</a>
<a moz-do-not-send="true" 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>
</blockquote>
<br>
You are both right. Thanks for raising this issue.<br>
<br>
I just pushed to GitHub a new Float32SlotsObject, and made Color
subclass of it. Color is no longer a Collection, and I hope I didn't
break too many things... Please take a look, and report any
problems.<br>
<br>
Cheers,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
</body>
</html>