[Cuis-dev] [Ann] Serialization of BlockClosures

Hernan Wilkinson hernan.wilkinson at 10pines.com
Wed Oct 2 09:32:37 PDT 2019


👏👏👏👏

On Wed, Oct 2, 2019 at 12:15 PM Juan Vuletich via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi Folks,
>
> (below)
>
> On 10/1/2019 1:25 AM, Phil B wrote:
>
> Juan,
>
> On Mon, Sep 30, 2019 at 11:43 PM Juan Vuletich via Cuis-dev <
> cuis-dev at lists.cuis.st> wrote:
>
>> Hi Nicolas,
>>
>> On 9/30/2019 8:36 PM, Nicolas Cellier via Cuis-dev wrote:
>>
>> Hi Juan,
>> Something strikes me.
>> 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?
>>
>>
> 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.)
>
>>
>> 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.
>>
>
> There are FFI reasons as well. (but that's an implementation detail)
>
>
>> 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.
>>
>
> 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?
>
>> --
>> Juan Vuletichwww.cuis-smalltalk.orghttps://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Devhttps://github.com/jvuletichhttps://www.linkedin.com/in/juan-vuletich-75611b3
>> @JuanVuletich
>>
>>
> Thanks,
> Phil
>
>
> You are both right. Thanks for raising this issue.
>
> 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.
>
> Cheers,
>
> --
> Juan Vuletichwww.cuis-smalltalk.orghttps://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Devhttps://github.com/jvuletichhttps://www.linkedin.com/in/juan-vuletich-75611b3
> @JuanVuletich
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191002/3ce0876f/attachment-0001.htm>


More information about the Cuis-dev mailing list