[squeak-dev] DynamicObjects

Robert robert.withers at pm.me
Mon Apr 20 11:21:05 UTC 2020


Such a constructed DynamicObject would be useful for Raven. The plan is to extend ASN1 de/encoding to callback to the Scope for each object in the graph being serialized to check for substitution. So using ASN1 to encode between machines. Consider a machine at level 1 and another machine who has advanced to level 3. Level 3 knows about #passByCopy objects that the level 1 machine knows not.

DynamicObject use cases, A) model an unknown class' instance, B) class generation & C)dynamic code loading

A) Level 3 machine sends such an advanced class to the level 1 machine. As this class structure gets decoded, without such a class available, construct as a DynamicObject and set the modeled instance variables with values. I am assuming that in addition to methods, instance variables can be defined with the DynamicObject, to model the ASN1 encoded object.

B) At this point level 1 does not know what to do about the level 3 dynamicObject. During development, an engineer could convert this DynamicObject to a class. So class definition meta-protocol will be needed.

C) During deployment, the DynamicObject could lookup the code Monticello package on the code server, for this new instance's class, and load it. In this fashion a network of nodes can stay updated.

Anyways, here are my use cases for DynamicObject or a similar construct.

K, r

On 4/20/20 5:03 AM, Marcel Taeumel wrote:

> Uhh! This feels like JavaScript ... :o) I would rather work on improving Squeak's meta-object protocol and with it class construction and refinement. Especially for tests. Let's not undermine the idea of having classes in Smalltalk.
>
> -1 for DynamicObject.
>
> Objects in Squeak/Smalltalk are quite dynamic already. That name is misleading. :-)
>
> Best,
> Marcel
>
>> Am 18.04.2020 19:55:05 schrieb Thiede, Christoph [<christoph.thiede at student.hpi.uni-potsdam.de>](mailto:christoph.thiede at student.hpi.uni-potsdam.de):
>>
>>> d := DynamicObject withMethods: {
>>>
>>> #origin -> [2 @ 3].
>>>
>>> #corner -> [3 @ 7] } asDictionary.
>>>
>>> d origin "2 at 3"
>>
>> Did we already have something like this for Squeak? May this become a pattern for situations where you actually don't need a class (e. g., when writing very small mock objects for tests)?
>>
>>> d := DynamicObject new.
>>>
>>> d xxxMethodAt: #foo put: [self inform: 'Hi!'].
>>>
>>> d xxxMethodAt: #foo: put: [:x | x halt].
>>>
>>> d foo: 3.
>>
>> Best,
>> Christoph

--
Kindly,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200420/f3d54dd4/attachment.html>


More information about the Squeak-dev mailing list