<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi Christoph --<div><br></div><div><span style="font-size: 10pt">Given that I needed to mimic the flexibility of morph's properties for the sake of robustness, we can add an extra "properties" instVar if necessary. Actually adding instVars for a non-essential extra in the Workspace tool felt overkill. </span><span style="font-size: 10pt">We might want to have this for all kinds of models. Would make extensions easier. So, it's not a "new thing" per se, but an idea present in morphs applied to models.</span><br></div><div><span style="font-size: 10pt"><br></span></div><div>Why do you see this as a "crazy hack"? It's rather interesting to have a tool that is able to reflect on its internals the same way as it does on external (user specified) information. ;-) Feels like a the textual version of a halo for a command line (or text buffer).<span style="font-size: 10pt"><br></span></div><div><br></div><div>If you think that the risk of a name collision in bindings is too high, we can choose a different prefix or add an extra dictionary instVar. But then we would loose that cool self-reflection feature. :-O</div><div><br></div><div>> <span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px">I only need to print "</span><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px">_fileDirectory" in a workspace and the menu will break.</span></div><div><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px"><br></span></div><div><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px">That's a bug. Why should a read operation change the bindings dictionary? I did not know that. Should be an easy fix. :-)</span></div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 27.11.2021 21:46:44 schrieb Thiede, Christoph <christoph.thiede@student.hpi.uni-potsdam.de>:</p><div style="font-family:Arial,Helvetica,sans-serif">


<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size: 12pt;color: #000000;font-family: Calibri,Helvetica,sans-serif">
<p>Hi Marcel,</p>
<p><br>
</p>
<p>crazy hack, but it bites with the fact that storing underscore variables in a Workspace is a legal operation. I only need to print "<span>_fileDirectory" in a workspace and the menu will break. Could we please just use a separate dictionary for the properties?
 :-)</span></p>
<p><span><br>
</span></p>
<p>Furthermore, how many different properties can actually be stored in a Workspace? So far I only counted 3 different keys - does this really justify the use of the Variable State pattern?</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><span style="font-family: Calibri, sans-serif;color: #000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
<b>Gesendet:</b> Donnerstag, 25. November 2021 11:44:04<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Trunk: Tools-mt.1074.mcz</span>
<div> </div>
</div>
</div>
<span style="font-size: 10pt"><span style="font-size: 10pt">
<div class="PlainText">Marcel Taeumel uploaded a new version of Tools to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Tools-mt.1074.mcz">http://source.squeak.org/trunk/Tools-mt.1074.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Tools-mt.1074<br>
Author: mt<br>
Time: 25 November 2021, 11:44:01.944354 am<br>
UUID: 39954290-b416-f242-a5b0-c7aea0e3c6a6<br>
Ancestors: Tools-mt.1073<br>
<br>
Adds a property protocol to Workspace to avoid having to go through #containingWindow to store extra stuff, which does not even work for MVC, just for morphs (i.e., SystemWindow, not StandardSystemView). Reuses a workspace's "bindings" with each property being
 prefixed with a "_" to not interfere with regular bindings.<br>
<br>
Note that such extra properties have already been added to #containingWindow in the past.<br>
<br>
=============== Diff against Tools-mt.1073 ===============<br>
<br>
Item was added:<br>
+ ----- Method: Workspace>>hasProperty: (in category 'binding - properties') -----<br>
+ hasProperty: aSymbol<br>
+ <br>
+        | propertyValue |<br>
+        propertyValue := self valueOfProperty: aSymbol.<br>
+        propertyValue ifNil: [^ false].<br>
+        propertyValue == false ifTrue: [^ false].<br>
+        ^ true!<br>
<br>
Item was changed:<br>
  ----- Method: Workspace>>initialize (in category 'initialize-release') -----<br>
  initialize<br>
         <br>
         super initialize.<br>
+        bindings := Dictionary new.<br>
-        self initializeBindings.<br>
         acceptDroppedMorphs := false.<br>
         mustDeclareVariables := self class declareVariablesAutomatically not.<br>
         environment := Environment current!<br>
<br>
Item was removed:<br>
- ----- Method: Workspace>>initializeBindings (in category 'binding') -----<br>
- initializeBindings<br>
-        <br>
-        bindings := Dictionary new!<br>
<br>
Item was added:<br>
+ ----- Method: Workspace>>removeProperty: (in category 'binding - properties') -----<br>
+ removeProperty: aSymbol<br>
+ <br>
+        bindings removeKey: ('_', aSymbol) asSymbol ifAbsent: [].!<br>
<br>
Item was added:<br>
+ ----- Method: Workspace>>resetBindings (in category 'binding') -----<br>
+ resetBindings<br>
+        "Remove all bindings that are not prefixed with an $_. See #setProperty:toValue:."<br>
+ <br>
+        bindings keysAndValuesRemove: [:key :value | key first ~= $_]!<br>
<br>
Item was added:<br>
+ ----- Method: Workspace>>setProperty:toValue: (in category 'binding - properties') -----<br>
+ setProperty: aSymbol toValue: anObject<br>
+ <br>
+        anObject ifNil: [^ self removeProperty: aSymbol].<br>
+        bindings at: ('_', aSymbol) asSymbol put: anObject.!<br>
<br>
Item was added:<br>
+ ----- Method: Workspace>>valueOfProperty: (in category 'binding - properties') -----<br>
+ valueOfProperty: aSymbol<br>
+ <br>
+        ^ self valueOfProperty: aSymbol ifAbsent: nil!<br>
<br>
Item was added:<br>
+ ----- Method: Workspace>>valueOfProperty:ifAbsent: (in category 'binding - properties') -----<br>
+ valueOfProperty: aSymbol ifAbsent: aBlock<br>
+ <br>
+        ^ bindings at: ('_', aSymbol) asSymbol ifAbsent: aBlock!<br>
<br>
<br>
</div>
</span></span>
</div></blockquote></div>