[squeak-dev] DynamicObjects

Jakob Reschke forums.jakob at resfarm.de
Sat Apr 18 18:16:00 UTC 2020


Would be nice for mock objects indeed. For everything else, well it is not
so much Smalltalk, rather Self or JavaScript, but without their syntax (and
maybe without prototype inheritance). Could be interesting and I am not
particularly against it, but users should know that this is not basic
Smalltalk. It might "delude" beginners if they get confronted with it too
early.

Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> schrieb am
Sa., 18. Apr. 2020, 19:55:

> 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/20200418/7e74cf17/attachment.html>


More information about the Squeak-dev mailing list