back back back

The Smalltalk fileOut format

Introduction

This document describes the format used for source and object interchange.
That format is based on an ascii representation of objects and can be used to transport source code and objects between different smalltalk systems.
The format was originally defined for ST-80 [4] and is compatible with ST-80, Digitalk and Smalltalk/X.

Definition

A file in this format consists of so called chunks of text. These are delimited by single exclamation marks (!) and all exclamation marks within a chunk are doubled (!!). Doubled exclamation marks may not contain a space in between.

A chunk consisting of whitespace only is called an empty chunk.

Each non empty chunk must represent a syntactically correct smalltalk expression.

Objects

Objects are stored as a chunk which, when evaluated, recreates the original object. Typically, an objects storeString is used for that purpose. For everything except literal objects (Number constants, String constants or Symbols), the storeString consists of a new or basicNew message, followed by messages to set the instance variables. For example, a chunk for a Set with 1,2 and 4 as elements looks like:
    (Set new add:1; add:2; add:3; yourself)
    !
Self referencing or otherwise recursive objects can (usually) not be represented in this format.

Class definitions

Class definition chunks consist of a message which creates the original class. Typically, it is one of the subclass creation messages defined in Class.
A typical class definition chunk may look like:
    StandardSystemView subclass:#Clock
	   instanceVariableNames:'clockView'
	   classVariableNames:''
	   poolDictionaries:''
	   category:'Demos'
    !

Method definitions

Method definitions consist of an initial methodsFor: chunk, followed by one or more method chunks. When evaluated at fileIn time, the first chunk will create an instance of ClassCategoryReader which itself will continue to read and compile the method chunks up to an empty chunk.
Typical method definitions look like:
    !Clock methodsFor:'examples'!

    foo
	"this is the foo method"

	^ 'foo'
    !

    bar
	"this is the bar method"

	^ 'bar'
    ! !
Notice the empty chunk at the end.


Copyright © Claus Gittinger Development & Consulting, all rights reserved

(cg@ssw.de)