<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jan 18, 2015 at 9:13 PM, Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Sun, 18 Jan 2015, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Chris Muller uploaded a new version of Environments to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Environments-cmm.53.mcz" target="_blank">http://source.squeak.org/<u></u>trunk/Environments-cmm.53.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Environments-cmm.53<br>
Author: cmm<br>
Time: 16 January 2015, 2:54:24.767 pm<br>
UUID: 69b32fc7-98f1-4c19-9976-<u></u>a38106a9ee63<br>
Ancestors: Environments-cmm.52<br>
<br>
- Only change key when it is NOT in the 'bindings' Dictionary, otherwise it would be in a state inconsistent with its new hash.<br>
<br>
=============== Diff against Environments-cmm.51 ===============<br>
<br>
Item was changed:<br>
----- Method: Environment>>renameClass:from:<u></u>to: (in category 'classes and traits') -----<br>
renameClass: aClass from: oldName to: newName<br>
"Rename the class, aClass, to have the title newName."<br>
<br>
| binding category |<br>
category := self organization categoryOfElement: oldName.<br>
self organization classify: newName under: category suppressIfDefault: true.<br>
self organization removeElement: oldName.<br>
<br>
+ binding := self associationAt: oldName.<br>
- binding := self declarationOf: oldName.<br>
</blockquote>
<br></span>
The Dictionary API shouldn't be used from new code, especially not from the Environments code itself.<br>
What was wrong with #declarationOf:? As I see the only difference is that it'll return nil instead of raising an error (#associationAt:). But that's not a problem, because the next line will raise an error anyway.</blockquote><div><br></div><div>Okay, we should change it back to declarationOf: then. I simply put it back like it was prior to cwp.50.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
declarations removeKey: oldName.<br>
+ bindings removeKey: oldName.<br>
+ " self binding: binding removedFrom: self."<br>
- self binding: binding removedFrom: self.<br>
<br>
+ binding key: newName.<br>
+ declarations add: binding.<br>
+ bindings add: binding.<br>
+ " self binding: binding addedTo: self."<br>
- binding := newName => aClass.<br>
- declarations add: binding.<br>
- self binding: binding addedTo: self.<br>
</blockquote>
<br></span>
I suspect that the removal of the #binding:removedFrom: and the #binding:addedTo: sends will break Environments, because another environment which imports this environment will not be notified about changes which happen here.<br></blockquote><div><br></div><div><div>The calls ot those are what had rename-class so severely broken. I tried to understand a proper fix but #binding:removedFrom: does a #perform on its 'removeSelector', (#hideBinding: in this case), which ends up doing a becomeForward: on the binding from the looked-up namespace to the one in the the receiver Environments 'bindings'. That kind of code is way too smart for me, and since #hideBinding: is the removeSelector used by all of Environments main "import" API, I decided to make this temporary fix isolated to the renameClass function, to minimize the impact on Environments.</div></div><div><br></div><div>In a nutshell, cwp.50 was attempting to fix rename class, but it made it worse, so this reversion lets us go back and "try again".</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">This problem is shadowed in case of Smalltalk - which imports itself - by the direct manipulation of the bindings dictionary.</blockquote></div><div><br></div><div><div>I don't care what solution we have as long as regular development works.<br></div></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><font color="#888888"><br>
<br>
Levente</font></span><div class=""><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Smalltalk renamedClass: aClass from: oldName to: newName.<br>
SystemChangeNotifier uniqueInstance<br>
classRenamed: aClass<br>
from: oldName<br>
to: newName<br>
inCategory: category!<br>
<br>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>