<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 27, 2014 at 7:20 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Currently we have:<br>
<br>
  Binding&gt;&gt;objectForDataStream: refStream<br>
        &quot;It&#39;s not yet clear how serialization should work in the presence of environments&quot;<br>
<br>
        self shouldBeImplemented.<br>
<br>
<br>
This prevents us from being able to save projects to local disk<br>
in Squeak trunk. See Mantis entry at:<br>
<br>
  <a href="http://bugs.squeak.org/view.php?id=7814" target="_blank">http://bugs.squeak.org/view.php?id=7814</a><br>
<br>
Any thoughts as to how this should be implemented?<br>
<br>
Taking the method comment literally, I would expect that serialization in<br>
the presence of environments should work identically to serialization in<br>
the absence of environments, at least as a default behavior. I suspect that<br>
is not hard to make this happen, but I don&#39;t know how to do it.<br></blockquote><div><br></div><div>Hi Dave, </div><div><br></div><div>Sorry about that. I really shouldn&#39;t have left that method unimplemented. </div><div><br></div><div>The easy fix for the default case is to use the same implementation as Association&gt;&gt;objectForDataStream:. This will make save and reloading of object work in the case where there&#39;s only one environment in the image. </div><div><br></div><div>The case of multiple environments boils down to this: saving objects to disk would have to be done from the perspective of a given environment, and loading would have to be done from that of an equivalent environment. Association&#39;s implementation special-cases instances that represent global variables so that they get looked up in &quot;Smalltalk globals&quot; when the objects are reloaded from disk. That should be replaced with &quot;Environment current&quot; so that the lookup happens in the environment we&#39;re loading against, rather than the environment where Binding is compiled. </div><div><br></div><div>Looking further up the layers of abstraction, each Project should probably have its own environment, which would be used for compiling custom code for that project, and serializing the project to disk.</div><div><br></div><div>In the meantime, though, let&#39;s fix the simple case. :-)</div><div><br></div><div>Colin</div></div></div></div>