Chunk file format

The chunk file format defines a means of storing class definitions and expressions to a text file. This can be filed in by choosing the File/File In... of the Transcript to recreate the definitions. As well as archiving the definition of a class it is also a useful medium for distributing the definitions, especially to people with other Smalltalk implementations.

Dolphins chunk file format

There is a standard file format in the Smalltalk world. Since this was published a number of Smalltalk implementations have deviated from it, principally with differing support for class and method categorization. Dolphin also joins this merry band through virtue of supporting multiple categories whereas the standard is restricted to one.

Classes

Classes are defined with the following expression:

Object subclass: #SourceManager
        instanceVariableNames: 'imagePath imageStamp '
        classVariableNames: 'ChangesIndex ChunkTerminator DefaultInstance SourcesIndex '
        poolDictionaries: ''!

This is the same as the standard except the category of the class is not set at this stage. Dolphin allows a class to belong to a number of class categories.

!SourceManager categoriesForClass!Change Control!Kernel-Change! !

This will make the SourceManager belong to both the supplied categories. If the #categoriesForClass message was not sent to the class it is placed in the 'No category' class category.

Methods

All the methods of a class are read in one go and the categories for each method are defined afterwards.

An excerpt of the file produced from the SourceManager class would be

!SourceManager methodsFor!

add: aStringFilename
        "Adds a file to the SourceManager."

        ^self subclassResponsibility!

changesExtension
        "Private - Answers the suffix to use for the changes file"

        ^'chg'! !

Trailing this the categories of each method are set. A method can belong to a number of categories. If the categories of a method are not supplied it is placed in the 'no category' method category.

!SourceManager categoriesFor: #add:!source code control! !
!SourceManager categoriesFor: #changesExtension!accessing!constants! !

The changeExtension method belongs to two method categories; accessing and constants.

Expressions

An expression to be evaluated is formed by the expression followed by the exclamation marker.

SourceManager initialize!

Importing from other Smalltalks

Dolphin can load files in the standard format and will also attempt to file in formats from the other commercial Smalltalk implementations while keeping their specific category information.

References

Glenn Krasner, "The Smalltalk-80 Code File Format" in Smalltalk-80: Bits of history, words of advice, Addison-Wesley, 1983.