Newbie Q: syntax of cs and st files -djb

Bert Freudenberg bert at
Sun Apr 6 10:08:39 UTC 2003

Am Sonntag, 06.04.03 um 04:17 Uhr schrieb Derek Brans:

> I am confused about the syntax of cs and st files.
> Are they the same?

Yes. There is an FAQ item at 
although it's not too detailed. Oh well, I put the explanation below 
there, too.

> Usually they look like code but there are no periods between 
> statements, just exclamations.

The exclamation mark marks the end of a "chunk" of code. Each chunk is 
evaluated separately by the compiler.

> Are doits (arbitrary code -- as opposed to addition of source code) 
> allowed in both file formats anywhere I want?

Yes, between top-level chunks. 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.

> If these files are just a series of doits, why have the command 
> "filein selection" in the text pane menu like the workspace?

Because the doit (that is, the Compiler) does not know the chunk format.

-- Bert

More information about the Squeak-dev mailing list