How to store/load alternate object representations?

Stephane Ducasse ducasse at iam.unibe.ch
Tue Aug 6 05:17:45 UTC 2002


Hi Ned

I do not have the answer but this may be related to a bug I noticed with 
project (in 3.2 not with your changes).
When I saved a project I have a certain font for the balloon I changed. 
When I reload the project I got
the default one. Pretty annoying to the point I stopped using projects.

Stef

PS: if somebody wants to look at them I can send code to reproduce it.


On mardi, août 6, 2002, at 06:09  AM, Ned Konz wrote:

> Hi wizards,
>
> I've made a new MorphProperties class to replace the
> IdentityDictionaries that were in the otherProperties instvar of
> MorphExtensions.
>
> But I want to be able to write backwards-compatible files; this should
> be pretty easy, as I can convert back and forth between
> MorphProperties and IdentityDictionary objects.
>
> So I overrode MorphExtension>>storeDataOn: to store an
> IdentityDictionary instead of the MorphProperties:
>
> MorphExtension>>
> storeDataOn: aDataStream
> 	"Store my properties as an IdentityDictionary for backwards
> compatibility"
> 	| oldProps |
> 	oldProps _ otherProperties.
> 	otherProperties _ otherProperties ifNotNil: [ IdentityDictionary
> newFrom: otherProperties ].
> 	[ super storeDataOn: aDataStream ] ensure: [ otherProperties _
> oldProps ]
>
>
> And then to read MorphExtensions back in, I have this:
>
> readDataFrom: aDataStream size: varsOnDisk
> 	"Fill in the fields of self based on the contents of aDataStream.
> Return self.
> 	 Read in the instance-variables written by Object>>storeDataOn:."
> 	super readDataFrom: aDataStream size: varsOnDisk.
> 	otherProperties _ MorphProperties convertedFrom: otherProperties.
>
>
> Problem is, when I store a project it still stores MorphProperties
> obejcts (which don't load into older images).
>
>
> What do I need to do to make sure that the MorphExtensions are always
> stored with IdentityDictionaries?
>
> Thanks,
> --
> Ned Konz
> http://bike-nomad.com
> GPG key ID: BEEA7EFE
>
>
>
Dr. Stéphane DUCASSE (ducasse at iam.unibe.ch) 
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do
  different? ... especially if, by doing something different, today
  might not be your last day on earth" Calvin&Hobbes




More information about the Squeak-dev mailing list