Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
SmartRefStream
Last updated at 12:24 pm UTC on 16 June 2018

The core of saving an object called 'theObject' (and its subobjects) with a SmartRefStream is

  srefStream := SmartRefStream on: theObject.
  srefStream nextPut: theObject.  "and all subobjects"
  srefStream close.		"also closes me"

(Implemented here)

Class comment:


Ordinary ReferenceStreams assume that the names and order of instance variables is exactly the same when an object file is written and read.
SmartRefStream allows object files to be read even after instance variables have changed or the entire class has been renamed.

When an object file is written, no one knows how the classes will change in the future. Therefore, all conversion must be done when the file is read. The key is to store enough information in the file about the names of the instance variables of all outgoing classes.

SmartRefStream works best with only one tree of objects per file. You can nextPut: more than once, but each object tree gets its own class structure description, which is big.

Conversion of old objects is done by a method


see SmartRefStream conversion methods


SmartRefStream is used when exporting an ImageSegment


Mariano Martinez Peck 1, Noury Bouraqadi, Stéphane Ducasse, Luc Fabresse
Object Swapping Challenges - an Evaluation of ImageSegment

See also