[squeak-dev] The Trunk: Morphic-cmm.1408.mcz

Eliot Miranda eliot.miranda at gmail.com
Thu Apr 5 15:31:38 UTC 2018


Hi Nicolas, Hi Marcel,

> On Apr 5, 2018, at 1:36 AM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
> 
> Hi Marcel,
> yes, but the goal is rather to get rid of a global state (The single active World) and replace with a specific world passed by message or whatever.
> In Project current world, we have messages that provide indirection levels instead of a direct access by global scope.
> This is maybe more robust to future change (in balance with less simplicity).
> But we still have a global state (The active world).
> Maybe that's what Eliot was meaning (but I should rather let Eliot speak).

Right.  The two are the same; they have exactly the same result (except when changing worlds because the two variables World and CurrentProject cannot be changed at exactly the same time).  One can put a breakpoint on world but not intercede with World, but that's fixable, and not necessarily useful.  So if the two are effectively the same why bother with a longer form?  There used to be a time when "let's get rid of globals" forced us to use SmalltalkImage current instead of Smalltalk, and we're still stuck with self systemNavigation.  The Smalltalk vm, Smalltalk navigation, Smalltalk image approach I like much more.  Project current world kind of breaks the law of Demeter.  If there's something wrong (for me) it's that World sounds like a class; TheWorld is better.

This is about brevity and modularity, but also about the system's architecture.  If the system contains a singleton (and it contains a few non-class singletons and /lots/ of class singletons) and that singleton is widely used (meaning it is global, not scopable to a class) and accessing it though a class isn't convenient (Project current is pretty convenient) then why not access it as a global instead of via a message sending path from some other variable?  Provided the name is good and the global refers to something fundamental to the system's architecture then I don't see the harm.

If World were a class then World current would be convenient and TheWorld wouldn't be compelling.

But isn't this about more?  If it is about the architecture of Morphic worlds and we have a world per project, and in Nebraska potentially shared worlds, and in general can come up with any number of worlds, active at the same time, then if we want, say, to open a window like another in a shared world, not the current world, then the morph should be saying self world /not/ World or Project current world.  And arguably self myWorld.  But the constraint that imposes is that a morph can't be in two worlds at once. If you want morphs to be in more than one world at once then that won't work.

So instead of focusing on the surface issue, which should be determined by readability and writability concerns, what's the deeper issue?  Is self world right?  If so, use it.

> 
> 2018-04-05 10:03 GMT+02:00 Marcel Taeumel <marcel.taeumel at hpi.de>:
>> Ah, sorry. In my mind, I separate classes from other globals. I was referring to these other globals. Classes are fine -- even though one should always evaluate the need for any new class in the system, too.
>> 
>> Best,
>> Marcel
>>> Am 05.04.2018 09:59:29 schrieb Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
>>> 
>>> But we replaced a global World by another global Project.
>>> It's more about limiting the number of globals to a set of more universal roots?
>>> 
>>> 2018-04-05 9:42 GMT+02:00 Marcel Taeumel <marcel.taeumel at hpi.de>:
>>>> Because with "Project current world" we have messaging (#current, #world) as point of variation. Pure state access via globals is too limited.
>>>> 
>>>> Best,
>>>> Marcel
>>>>> Am 04.04.2018 20:18:58 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
>>>>> 
>>>>> 
>>>>> 
>>>>> On Tue, Apr 3, 2018 at 11:44 PM, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
>>>>>> It should be "Project current world" then.
>>>>> 
>>>>> But World == Project current world. Why not just World?  (That's a sincere question, not an attempt to disagree)
>>>>>  
>>>>>> 
>>>>>> Best,
>>>>>> Marcel
>>>>>>> Am 04.04.2018 06:17:03 schrieb commits at source.squeak.org <commits at source.squeak.org>:
>>>>>>> 
>>>>>>> Chris Muller uploaded a new version of Morphic to project The Trunk:
>>>>>>> http://source.squeak.org/trunk/Morphic-cmm.1408.mcz
>>>>>>> 
>>>>>>> ==================== Summary ====================
>>>>>>> 
>>>>>>> Name: Morphic-cmm.1408
>>>>>>> Author: cmm
>>>>>>> Time: 3 April 2018, 11:15:51.160237 pm
>>>>>>> UUID: 35b2e2ad-c421-4510-a635-774bfd84e597
>>>>>>> Ancestors: Morphic-cmm.1407
>>>>>>> 
>>>>>>> The responsibility of #anyOpenWindowLikeMe, as indicated by its name, is to look in the actual World world for any open window like the receiver, not the receivers #world (which is nil, because because we wish to look in the real world first!).
>>>>>>> Fixes the Reuse Windows preference.
>>>>>>> 
>>>>>>> =============== Diff against Morphic-cmm.1407 ===============
>>>>>>> 
>>>>>>> Item was changed:
>>>>>>> ----- Method: SystemWindow>>anyOpenWindowLikeMe (in category 'open/close') -----
>>>>>>> anyOpenWindowLikeMe
>>>>>>> 
>>>>>>> self class reuseWindows ifFalse: [ ^Array empty ].
>>>>>>> ^ SystemWindow
>>>>>>> + windowsIn: World 
>>>>>>> - windowsIn: self world 
>>>>>>> satisfying: 
>>>>>>> [ : each |
>>>>>>> each model class = self model class
>>>>>>> and: [ (each model respondsTo: #representsSameBrowseeAs:) 
>>>>>>> and: [ each model representsSameBrowseeAs: self model ] ] ]
>>>>>>> !
>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> _,,,^..^,,,_
>>>>> best, Eliot
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180405/a07c3aa1/attachment.html>


More information about the Squeak-dev mailing list