[squeak-dev] What about "self currentProject"?

Marcel Taeumel marcel.taeumel at hpi.de
Tue Mar 2 13:34:49 UTC 2021


Class references are global references. The piece "self currentProject" does not reveal where it is coming from. It is a good thing to not expose global state to user code -- even if it is global at the moment. :-)

Best,
Marcel
Am 02.03.2021 14:30:11 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:
Hi Marcel,

could you maybe share some more details about this particular design goal of Newspeak? :-)

At the first glance, I do not really see the advantages of moving more and more "global getters" to Object. It:
- inflates the Object protocol even more
- might imply that there is some connection between the receiver and the project, or at least hide the global state (which one also could call "code perfuming" :-))
- and I don't see how it could help to replace the global object at all - you still need to wrap relevant calls with #becomeActiveDuring:, or speaking more in general about the proposed idiom, you would still need something like method wrappers unless you only want to override #currentThing for a single instance.

So what possible advantages am I missing right now? :)

Best,
Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Dienstag, 2. März 2021 10:03:02
An: squeak-dev
Betreff: [squeak-dev] What about "self currentProject"?
 
Hi all!

After typing "Project current" for the n-th time, I was wondering, whether "self currentProject" could be a nice little idiom for the Squeak environment. 

We had several thoughts on this matter:
http://forum.world.st/Object-gt-gt-currentProjectWorld-td5044161.html#a5045072 [http://forum.world.st/Object-gt-gt-currentProjectWorld-td5044161.html#a5045072]

http://forum.world.st/Changeset-Eliminating-global-state-from-Morphic-tp5121690p5123334.html [http://forum.world.st/Changeset-Eliminating-global-state-from-Morphic-tp5121690p5123334.html]


1. Object >> #currentProject would be a *System extension in Object to not be dependent on Morphic.
2.  "Project current world" could be replaced with "self currentProject world" (generic) or "self currentWorld" (specific to Morphic).
3. "Project uiManager" could be replaced with "self currentProject uiManager".
4. "Project current addDeferredUIMessage:" could be replaced with "self currentProject addDeferredUIMessage:".

So, we wouldn't have so many class references to "Project" in the code. It kind of reminds me about some of Newspeak's design goals. :-)

What do you think?

Best,
Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210302/493f6135/attachment.html>


More information about the Squeak-dev mailing list