[squeak-dev] MorphicProject subclass: #EtoysProject

David T. Lewis lewis at mail.msen.com
Sun Oct 22 00:33:20 UTC 2017

On Fri, Oct 06, 2017 at 03:48:56PM +0200, Bert Freudenberg wrote:
> On Fri, Oct 6, 2017 at 2:44 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> >
> > So we might have some kind of rule in project loading that says "if
> > the current project is an EtoysProject, and if I am loading a *.pr for
> > a MorphicProject, then make it an EtoysProject". And perhaps when saving
> > a project, we could reverse the rule and always save a project as
> > MorphicProject, because we know that a loader in EtoysProject will know
> > how to do the right thing with it.
> >
> ???Actually, projects saved from the Squeakland image store a class named
> "Project???". Since this has been made abstract now, we instead load it as
> MorphicProject.
> ???The logic is mostly in SmartRefStream, in this case, #initKnownRenames.

I decided to play around with this a bit, and put some experimental updates
in the http://www.squeaksource.com/EtoysProject repository. This allows a
project file to be dropped into an EtoysProject, and the resulting new project
will be EtoysProject rather than MorphicProject. When transitioning from an
EtoysProject to something else (usually a MorphicProject), the Etoys-specific
preference overrides are restored to normal. When moving from one EtoysProject
to another, the preference overrides should stay in effect.

Dropping a project file into a MorphicProject still creates a new MorphicProject
as before.

I'm not sure this is a good idea, and it is surely going to be full of bugs,
but it does seem to work.

The updates:

  Name: Collections-dtl.765
  Author: dtl
  Time: 21 October 2017, 7:44:28.846825 pm
  UUID: 0109fe1c-9f9b-4826-ab6b-dac5db14ba18
  Ancestors: Collections-topa.764
  Assuming that the object saved as a Dictionary value may be any object that
  responds to #value (i.e. a block), implement keyAtEvaluatedValue: to look
  up the key corresponding the the evaluated object.
  Name: System-dtl.970
  Author: dtl
  Time: 21 October 2017, 7:51:39.874717 pm
  UUID: 90db9247-00c0-4f0d-a205-c7121125b971
  Ancestors: System-dtl.969
  The #renamed dictionary of a SmartReferenceStream maps a serialized class,
  such as Project, to the expected class to be used for materialization, such
  as MorphicProject. In some cases it may be desirable to let the mapping choice
  be decided at load time. Therefore, let the value stored in #renamed be
  either a symbol or a block. If it is a block, evaluated it to determine the
  new mapped class. For example, if EtoysProject is a specialized implementation
  of MorphicProject, then it may be desirable to map a saved Project to a new
  EtoysProject rather than a new MorphicProject.
  Name: Project-Etoys-dtl.2
  Author: dtl
  Time: 21 October 2017, 7:55:23.65049 pm
  UUID: 7a7f7f95-c623-4024-be85-af380d03ca4f
  Ancestors: Project-Etoys-dtl.1
  Restore saved global preferences only if the project being entered is not
  an EtoysProject. Thus retain the preference overrides while moving from one
  EtoysProject to another.


More information about the Squeak-dev mailing list