<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi all,</p>
<p><br>
</p>
<p>recent discussions have shown just another time that in spite of its overall modular and object-oriented design, the Morphic System still incorporates a number of global state variables that impede modular processes in some situations. For instance, running
 or even debugging any form of UI simulation code in a background process was likely to cause problems because, via the global state variables, two planned-to-be-independent projects undesirably shared their events, hands, and worlds. Concrete systems suffering
 from this global state include various UI tests executed using AutoTDD [1], or the screenshot generation framework for Squeak by Example [2] which I had the joy to co-develop.</p>
<p><br>
</p>
<p>The attached changeset tackles these issues for all packages in the Trunk by wrapping the following three globals into process-local accessors: ActiveEvent, ActiveHand, and ActiveWorld.</p>
<p>As the changeset contains patches of over 300 selectors in more than 100 classes every single line of which you probably will not feel like reading in detail, here is a summary of all changes I applied:</p>
<p></p>
<ul style="margin-bottom: 0px; margin-top: 0px;">
<li>Added #activeEvent[:], #activeHand[:], and #activeWorld[:] process-local accessors on Object as Morphic-Kernel extensions. The actual values are stored directly on the active process in the manner of a <span>ProcessSpecificVariable. For backward compatibility,
 the global variables are still kept up to date here.</span></li><li><span>Added #activateHand:during: and #activateWorld:during: as dynamic scope setters on Object as Morphic-Kernel extensions.</span></li><li><span>Replaced all references to ActiveEvent, ActiveHand, and ActiveWorld by "self activeEvent", "self activeHand", and "self activeWorld" accordingly. I also spent some time reflecting in which cases you actually would like to receive a possible nil value
 and ended up with changing the most senders that are not involved into the critical event processing logic into their "#current*" equivalents (#currentEvent, #currentHand, and #currentWorld) which already guarantee to return non-nil values. In the case of
 #currentWorld, I also replaced many senders with "Project current world" that were not invoked in an event-related context.</span></li><li><span>While skimming over all the implementations, I also applied a number of really minor refactorings: improve multilingual support by adding some "#translated"s to user strings, remove nil checks that could never be reached, and reformat some of the
 very hardest to read methods I came across.</span></li></ul>
<p></p>
<p><br>
</p>
<p>Please review! I'm looking forward to eliminating these unnecessary artifacts of global state and making Squeak an even more purely object-oriented and modular system by merging these changes into the Trunk.</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<p><br>
</p>
<p>[1] <a href="https://github.com/hpi-swa-teaching/AutoTDD" class="OWAAutoLink" id="LPlnk685907" previewremoved="true">https://github.com/hpi-swa-teaching/AutoTDD</a></p>
<p>[2] <a href="https://github.com/codeZeilen/SqueakByExample-english/" class="OWAAutoLink" id="LPlnk356955" previewremoved="true">https://github.com/codeZeilen/SqueakByExample-english/</a></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
</body>
</html>