[squeak-dev] It's not yet clear how serialization should work in the presence of environments

Colin Putney 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:
>
>   http://bugs.squeak.org/view.php?id=7814
>
> 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.
>

Hi Dave,

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. :-)

Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140927/14412c9e/attachment.htm


More information about the Squeak-dev mailing list