[squeak-dev] It's not yet clear how serialization should work in
the presence of environments
colin at wiresong.com
Sun Sep 28 03:01:31 UTC 2014
On Sat, Sep 27, 2014 at 7:20 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> Currently we have:
> Binding>>objectForDataStream: refStream
> "It's not yet clear how serialization should work in the presence
> of environments"
> self shouldBeImplemented.
> This prevents us from being able to save projects to local disk
> in Squeak trunk. See Mantis entry at:
> Any thoughts as to how this should be implemented?
> Taking the method comment literally, I would expect that serialization in
> the presence of environments should work identically to serialization in
> the absence of environments, at least as a default behavior. I suspect that
> is not hard to make this happen, but I don't know how to do it.
Sorry about that. I really shouldn't have left that method unimplemented.
The easy fix for the default case is to use the same implementation as
Association>>objectForDataStream:. This will make save and reloading of
object work in the case where there's only one environment in the image.
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's implementation special-cases instances that represent global
variables so that they get looked up in "Smalltalk globals" when the
objects are reloaded from disk. That should be replaced with "Environment
current" so that the lookup happens in the environment we're loading
against, rather than the environment where Binding is compiled.
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.
In the meantime, though, let's fix the simple case. :-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev