This document describes the class libraries that are distributed together with the gnu Smalltalk programming language.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.
Alphabetic list:
Classes documented in this manual are boldfaced.
Autoload
Object
Behavior
ClassDescription
Class
Metaclass
BlockClosure
Boolean
False
True
CObject
CAggregate
CArray
CPtr
CString
CCallable
CCallbackDescriptor
CFunctionDescriptor
CCompound
CStruct
CUnion
CScalar
CChar
CDouble
CFloat
CInt
CLong
CLongDouble
CShort
CSmalltalk
CUChar
CByte
CBoolean
CUInt
CULong
CUShort
ContextPart
BlockContext
MethodContext
Continuation
CType
CPtrCType
CArrayCType
CScalarCType
CStringCType
Delay
Directory
DLD
DumperProxy
AlternativeObjectProxy
NullProxy
VersionableObjectProxy
PluggableProxy
SingletonProxy
FilePath
File
VFS.ArchiveMember
VFS.TmpFileArchiveMember
VFS.StoredZipMember
VFS.FileWrapper
VFS.ArchiveFile
VFS.ZipFile
FileSegment
Getopt
Iterable
Collection
Bag
HashedCollection
Dictionary
BindingDictionary
AbstractNamespace
Namespace
RootNamespace
SystemDictionary
LookupTable
IdentityDictionary
MethodDictionary
WeakValueLookupTable
WeakValueIdentityDictionary
WeakKeyDictionary
WeakKeyIdentityDictionary
Set
IdentitySet
WeakSet
WeakIdentitySet
MappedCollection
SequenceableCollection
ArrayedCollection
Array
WeakArray
ByteArray
CharacterArray
String
Symbol
UnicodeString
CompiledCode
CompiledBlock
CompiledMethod
Interval
LargeArrayedCollection
LargeArray
LargeByteArray
LargeWordArray
WordArray
LinkedList
Semaphore
OrderedCollection
RunArray
SortedCollection
Stream
FileDescriptor
FileStream
Generator
ObjectDumper
PositionableStream
ReadStream
WriteStream
ReadWriteStream
Random
TextCollector
Kernel.PackageInfo
Package
Kernel.TrappableEvent
ExceptionSet
Link
Process
CallinProcess
SymLink
Magnitude
Character
UnicodeCharacter
Date
DateTime
LookupKey
Association
HomedAssociation
VariableBinding
DeferredVariableBinding
Number
Float
FloatD
FloatE
FloatQ
Fraction
Integer
LargeInteger
LargeNegativeInteger
LargePositiveInteger
LargeZeroInteger
SmallInteger
ScaledDecimal
Time
Duration
Memory
Message
DirectedMessage
MethodInfo
NetClients.URIResolver
NetClients.URL
ObjectMemory
PackageLoader
Permission
Point
ProcessEnvironment
ProcessorScheduler
Rectangle
RecursionLock
Regex
RegexResults
SecurityPolicy
SharedQueue
Signal
Exception
Error
ArithmeticError
ZeroDivide
MessageNotUnderstood
SystemExceptions.InvalidValue
SystemExceptions.EmptyCollection
SystemExceptions.InvalidArgument
SystemExceptions.AlreadyDefined
SystemExceptions.ArgumentOutOfRange
SystemExceptions.IndexOutOfRange
SystemExceptions.InvalidSize
SystemExceptions.NotFound
SystemExceptions.PackageNotAvailable
SystemExceptions.InvalidProcessState
SystemExceptions.NotIndexable
SystemExceptions.ProcessTerminated
SystemExceptions.ReadOnlyObject
SystemExceptions.WrongClass
SystemExceptions.MustBeBoolean
SystemExceptions.MutationError
SystemExceptions.NotEnoughElements
SystemExceptions.NotImplemented
SystemExceptions.NotYetImplemented
SystemExceptions.ShouldNotImplement
SystemExceptions.SubclassResponsibility
SystemExceptions.WrongMessageSent
SystemExceptions.VMError
SystemExceptions.BadReturn
SystemExceptions.NoRunnableProcess
SystemExceptions.PrimitiveFailed
SystemExceptions.CInterfaceError
SystemExceptions.FileError
SystemExceptions.WrongArgumentCount
SystemExceptions.SecurityError
SystemExceptions.UserInterrupt
SystemExceptions.VerificationError
Halt
Notification
SystemExceptions.EndOfStream
SystemExceptions.ProcessBeingTerminated
Warning
SystemExceptions.UnhandledException
UndefinedObject
ValueAdaptor
NullValueHolder
PluggableAdaptor
DelayedAdaptor
ValueHolder
Promise
If start < stop, these are replaced by the contents of the replacementCollection. Instead, If start = (stop + 1), like in `copyReplaceFrom: 4 to: 3 with: anArray', then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index `start'.
If start < stop, these are replaced by stop-start+1 copies of anObject. Instead, If start = (stop + 1), then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index `start'.
Do not send this in user code; use #compile: or related methods instead.
Do not send this in user code; use #compile:ifError: or related methods instead.
My keys are (expected to be) symbols, so I use == to match searched keys to those in the dictionary – this is done expecting that it brings a bit more speed.
Important: this method is public, but it is intended to be used in very special cases (as a rule of thumb, use it only when the corresponding C code uses the _gst_prepare_execution_environment and _gst_finish_execution_environment functions). You should usually rely on #ensure: and #on:do:.
Character is always used (mostly for performance reasons) when referring to characters whose code point is between 0 and 127. Above 127, instead, more care is needed: Character refers to bytes that are used as part of encoding of a character, while UnicodeCharacter refers to the character itself.
In both cases, aValue should be of the element type or of the corresponding Smalltalk type (that is, a String is ok for an array of CStrings) to avoid typing problems which however will not be signaled because C is untyped.
I use my first element instead of myself as a prototype because my elements are more likely to share the desired properties than I am, such as in:
#('hello, ' 'world') join => 'hello, world'
The first three have a meaning only for those bytecodes that represent a combination of operations: the combination can be BC1 ARG BC2 OPERAND if the fourth byte's bit 0 = 0 or BC1 OPERAND BC2 ARG if the fourth byte's bit 0 = 1
where BC1 is the first byte, BC2 is the second, ARG is the third and OPERAND is the bytecode argument as it appears in the bytecode stream.
If the flags field of the method header is 6, this method instead provides a hook from which the virtual machine can call back whenever execution of the method is requested. In this case, invoking the method would cause an infinite loop (the VM asks the method to run, the method asks the VM to invoke it, and so on), so this method fails with a #subclassResponsibility error.
Note that like CChar is a pointer to char, CString is actually a *pointer* to string: a char ** in C terms. If you need to take a String out of a char *, use CChar>>#asString.
In general, I behave like a cross between an array of characters and a pointer to a character. I provide the protocol for both data types. My #value method returns a Smalltalk String, as you would expect for a scalar datatype.
My only instance variable, cObjectType, is used to hold onto the CObject subclass that gets created for a given CType. Used primarily in the C part of the interpreter because internally it cannot execute methods to get values, so it has a simple way to access instance variable which holds the desired subclass.
My subclasses have instances which represent the actual data types; for the scalar types, there is only one instance created of each, but for the aggregate types, there is at least one instance per base type and/or number of elements.
PLEASE BE WARNED – use this class only for dates after 1582 AD; that's the beginning of the epoch. Dates before 1582 will not be correctly printed. In addition, since ten days were lost from October 5 through October 15, operations between a Gregorian date (after 15-Oct-1582) and a Julian date (before 5-Oct-1582) will give incorrect results; or, 4-Oct-1582 + 2 days will yield 6-Oct-1582 (a non-existent day!), not 16-Oct-1582.
In fact, if you pass a year < 1582 to a method like #newDay:month:year: it will assume that it is a two-digit year (e.g. 90=1990, 1000=2900). The only way to create Julian calendar dates is with the #fromDays: instance creation method.
In almost all places where you would use a plain Dictionary, a LookupTable would be more efficient; see LookupTable's comment before you use it. I do have a couple of special features that are useful in certain special cases.
I am just an ancillary class used to reference some C functions. Most of my actual functionality is used by redefinitions of methods in CFunctionDescriptor.
Internally, Exception and every subclass of it hold onto a CoreException, so the two mechanisms are actually interchangeable.
The file will be automatically closed upon GC if the object is not referenced anymore, but it is better to close it as soon as you're finished with it anyway, using #close. To keep a file open even when no references exist anymore, send it #removeToBeFinalized
The file will be automatically closed upon GC if the object is not referenced anymore, but it is better to close it as soon as you're finished with it anyway, using #close. To keep a file open even when no references exist anymore, send it #removeToBeFinalized
A generator block is converted to a Generator with "Generator on: [...]". The Generator itself is passed to the block, and as soon as a message like #next, #peek, #atEnd or #peekFor: is sent to the generator, execution of the block starts/resumes and goes on until the generator's #yield: method is called: then the argument of #yield: will be the Generator's next element. If the block goes on to the end without calling #yield:, the Generator will produce no more elements and #atEnd will return true.
You could achieve the effect of generators manually by writing your own class and storing all the local variables of the generator as instance variables. For example, returning a list of integers could be done by setting a variable to 0, and having the #next method increment it and return it. However, for a moderately complicated generator, writing a corresponding class would be much messier (and might lead to code duplication or inefficiency if you want to support #peek, #peekFor: and/or #atEnd): in general, providing a #do:-like interface is easy, but not providing a Stream-like one (think binary trees).
The idea of generators comes from other programming languages, in particular this interface looks much like Scheme streams and Python generators. But Python in turn mutuated the idea for example from Icon, where the idea of generators is central. In Icon, every expression and function call behaves like a generator, and if a statement manages scalars, it automatically uses up all the results that the corresponding generator provides; on the other hand, Icon does not represent generators as first-class objects like Python and Smalltalk do.
If an error is found, nil is returned. For more information on the syntax of pattern, see #parse:with:do:ifError:.
If an error is found, the parsing is interrupted, errorBlock is evaluated, and the returned value is answered.
Every whitespace-separated part (`word') of pattern specifies a command-line option. If a word ends with a colon, the option will have a mandatory argument. If a word ends with two colons, the option will have an optional argument. Before the colons, multiple option names (either short names like `-l' or long names like `–long') can be specified. Before passing the option to actionBlock, the name will be canonicalized to the last one.
Prefixes of long options are accepted as long as they're unique, and they are canonicalized to the full name before passing it to actionBlock. Additionally, the full name of an option is accepted even if it is the prefix of a longer option.
Mandatory arguments can appear in the next argument, or in the same argument (separated by an = for arguments to long options). Optional arguments must appear in the same argument.
As an example of using me, consider implenting a Dictionary whose elements are indexed. The domain would be a SequenceableCollection with n elements, the map a Dictionary associating each key to an index in the domain. To access by key, to perform enumeration, etc. you would ask an instance of me; to access by index, you would access the domain directly.
Another idea could be to implement row access or column access to a matrix implemented as a single n*m Array: the Array would be the domain, while the map would be an Interval.
That is, the attribute being set to true means that the context and all those above it are to be hidden, while the attribute being set to false means that the contexts above it must be hidden, but not the context itself.
This method should not be overridden
This method should not be overridden
This method should not be overridden
This method should not be overridden
This method should not be overridden
This method should not be overridden
The data is stored in a very compact format, which has the side effect of making loading much faster when compared with compiling the Smalltalk code prepared by #storeOn:. In addition, my instances support circular references between objects, while #storeOn: supports it only if you know of such references at design time and you override #storeOn: to deal with them
ObjectMemory has both class-side and instance-side methods. In general, class-side methods provide means to tune the parameters of the memory manager, while instance-side methods are used together with the #current class-side method to take a look at statistics on the memory manager's state.
For a packages.xml found in the system kernel directory's parent directory, all three directories are searched. For a packages.xml found in the local kernel directory's parent directory, only directories 2 and 3 are searched. For a packages.xml directory in the local image directory, instead, only directory 3 is searched.
For a packages.xml found in the kernel directory's parent directory, all three directories are searched. For a packages.xml found in the `.st' subdirectory, only directories 2 and 3 are searched. For a packages.xml directory in the local image directory, finally, only directory 3 is searched.
Creation of Regex objects inside a loop is of course slower than creating them outside the loop, but special care is taken so that the same Regex object is used whenever possible (when converting Strings to Regex, the cache is sought for an equivalent, already constructed Regex).