Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
FAQ: FileOut Code Format
Last updated at 12:15 pm UTC on 16 January 2006
A "file out" is a textfile containing a snapshot of Smalltalk sourcecode. These files typically end with the suffix ".st". When "filed in" the expressions in the file are actually evaluated using the Compiler - this means that a .st file can also contain arbitrary code that will be executed when filed in.

The other dominant format for distributing Squeak source code in files is ChangeSets, which uses the same file format.

What is the precise syntax for fileIn/fileOut?

The ! character delimits what are called "chunks" (!'s occurring within the chunk are doubled). Each chunk is evaluated separately by the compiler. If a chunk starts with an exclamation mark, the result of the chunk (a "chunk reader" object created by evaluating the chunk) is sent the #scanFrom: message. The #scanFrom: method then reads more of the stream. Only when it returns, you are on the top-level again.

A typical custom chunk reader is the ClassCategoryReader which is created by the #methodsFor:stamp: message send to some class. You see this a lot in change files. Other chunk readers may even read binary stuff, which is used for project files, for example.

You can see how chunks work by looking at senders and implementors of:
PositionableStream, WriteStream and ReadWriteStream have a method category "fileIn/Out".

Look at methods whose selector contains: "filein" or "fileout" using the Method Finder.