SmartRefStream broken?

Aaron Reichow revaaron at
Tue Nov 14 20:40:46 UTC 2006


We were having a discussion on #squeak about SqueakMap, older images,  
and SmartRefStream. Eventually, we were sharing snippets of code. We  
were trying to do the following:

"Save the data"
| data rr |
data := Dictionary new.
data at: #Meef put: 25;
         at: 23 put: 'Amanda';
         at: 'Small Numbers' put: #(0 1 2 3 four).
rr := SmartRefStream fileNamed: 'data.obj'.
rr nextPut: data; close.

"Restore it!"
| restoredData rr |
rr := SmartRefStream fileNamed: 'data.obj'.
restoredData := rr next.
restoredData inspect.
rr close.

This doesn't work. You can save the serialized object, but when you  
try to run the restore snippit, you get a walkback. One note- it does  
work just fine when you replace SmartRefStream with ReferenceStream -  
that works fine on both the saving and the restoring.  All examples  
of serializing objects I can find involve ReferenceStream or an  
ImageSegment, nothing with the SRS.  That said, SmartRefStream has  
some features that are useful and we'd like to use.

I won't put the whole walk back here- the code will bring up this  
error in any image. I tried the following images-

2.2: doesn't exist there.
2.4, 2.8, 3.2, 3.4, 3.8: the same error.

My first question- are we using it wrong?  Any other ideas?


More information about the Squeak-dev mailing list