[squeak-dev] DynamicObjects

Marcel Taeumel marcel.taeumel at hpi.de
Mon Apr 20 09:03:59 UTC 2020


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>:
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200420/16d43825/attachment.html>


More information about the Squeak-dev mailing list