A chunk consisting of whitespace only is called an empty chunk.
Each non empty chunk must represent a syntactically correct smalltalk expression.
#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
.
Object subclass:#Foo
instanceVariableNames:'foo bar'
classVariableNames:''
poolDictionaries:''
category:'Demos'
!
ST/V uses a variant of the above (it does not support
class categories). This is also supported
by both the incremental and the batch compilers in ST/X:
ST/X allows classes to be declared private for some other class;
a private class is only visible to its owning class.
If both a private class AND a non-private class with the same name
(say "Foo") exist,
the identifier "Foo" will refer to the private class within the
owning class, and to the global class everywhere else.
Foo subclass:#Bar
instanceVariableNames:'baz'
classVariableNames:''
poolDictionaries:''
!
To access the global class within the owning class, use a namespace override
construct, such as "Smalltalk::Foo".
Private classes are declared with:
Support for private classes is an ST/X feature - it may not be
available on other smalltalk systems.
SomeSuperclass subclass:#NameOfClass
instanceVariableNames:''
classVariableNames:''
privateIn:OwningClass
!
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.
!Foo methodsFor:'examples'!
foo
"this is the foo method"
^ 'foo'
!
bar
"this is the bar method"
^ 'bar'
! !
Notice the empty chunk at the end.
ST/V uses a variant of the above (it also lacks method
categories). This is also supported
by both the incremental and the batch compilers in ST/X:
!Bar methods!
foo
"this is the foo method"
^ 'foo'
!
bar
"this is the bar method"
^ 'bar'
! !
Copyright © 1995 Claus Gittinger Development & Consulting
<cg@exept.de>