GNU Smalltalk Library Reference


Up: (DIR)

GNU Smalltalk Library Reference

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”.


Next: , Previous: Top, Up: Top

1 Base classes

Alphabetic list:

Classes documented in this manual are boldfaced.

     
Autoload
Object
  Behavior
    ClassDescription
      Class
      Metaclass
  BlockClosure
  Boolean
    False
    True
  CFunctionDescriptor
  CObject
    CAggregate
      CArray
      CPtr
        CString
    CCompound
      CStruct
        VFS.CStatStruct
      CUnion
    CScalar
      CChar
      CDouble
      CFloat
      CInt
      CLong
      CLongDouble
      CShort
      CSmalltalk
      CUChar
        CByte
          CBoolean
      CUInt
      CULong
      CUShort
  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
            Regex
            Symbol
          UnicodeString
        CompiledCode
          CompiledBlock
          CompiledMethod
        Interval
        LargeArrayedCollection
          LargeArray
          LargeByteArray
          LargeWordArray
        WordArray
      LinkedList
        Semaphore
      OrderedCollection
        RunArray
        SortedCollection
  ContextPart
    BlockContext
    MethodContext
  Continuation
  CType
    CPtrCType
      CArrayCType
    CScalarCType
      CStringCType
  Delay
  DLD
  DumperProxy
    AlternativeObjectProxy
      NullProxy
        VersionableObjectProxy
      PluggableProxy
      SingletonProxy
  File
    Directory
  FileSegment
  Getopt
  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
  ProcessorScheduler
  Rectangle
  RecursionLock
  RegexResults
  SecurityPolicy
  SharedQueue
  Signal
    Exception
      Error
        Halt
          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
      Notification
        SystemExceptions.EndOfStream
        SystemExceptions.ProcessBeingTerminated
        Warning
  Stream
    Generator
    ObjectDumper
    PositionableStream
      ReadStream
      WriteStream
        ReadWriteStream
          ByteStream
            FileDescriptor
              FileStream
    Random
    TextCollector
  UndefinedObject
  ValueAdaptor
    NullValueHolder
    PluggableAdaptor
      DelayedAdaptor
    ValueHolder
      Promise
  VFS.VFSHandler
    VFS.ArchiveMemberHandler
      VFS.TmpFileArchiveMemberHandler
    VFS.FileHandlerWrapper
      VFS.ArchiveFileHandler
      VFS.DecodedFileHandler
    VFS.RealFileHandler


Next: , Up: Base classes

1.1 AbstractNamespace

Defined in namespace Smalltalk
Superclass: BindingDictionary
Category: Language-Implementation
I am a special form of dictionary. Classes hold on an instance of me; it is called their `environment'.


Next: , Up: AbstractNamespace

1.1.1 AbstractNamespace class: instance creation

new
Disabled - use #new to create instances


primNew: parent name: spaceName
Private - Create a new namespace with the given name and parent, and add to the parent a key that references it.


Next: , Previous: AbstractNamespace class-instance creation, Up: AbstractNamespace

1.1.2 AbstractNamespace: accessing

allAssociations
Answer a Dictionary with all of the associations in the receiver and each of its superspaces (duplicate keys are associated to the associations that are deeper in the namespace hierarchy)


allBehaviorsDo: aBlock
Evaluate aBlock once for each class and metaclass in the namespace.


allClassObjectsDo: aBlock
Evaluate aBlock once for each class and metaclass in the namespace.


allClassesDo: aBlock
Evaluate aBlock once for each class in the namespace.


allMetaclassesDo: aBlock
Evaluate aBlock once for each metaclass in the namespace.


classAt: aKey
Answer the value corrisponding to aKey if it is a class. Fail if either aKey is not found or it is associated to something different from a class.


classAt: aKey ifAbsent: aBlock
Answer the value corrisponding to aKey if it is a class. Evaluate aBlock and answer its result if either aKey is not found or it is associated to something different from a class.


Next: , Previous: AbstractNamespace-accessing, Up: AbstractNamespace

1.1.3 AbstractNamespace: basic & copying

= arg
Answer whether the receiver is equal to arg. The equality test is by default the same as that for equal objects. = must not fail; answer false if the receiver cannot be compared to arg


hash
Answer an hash value for the receiver. This is the same as the object's #identityHash.


Next: , Previous: AbstractNamespace-basic & copying, Up: AbstractNamespace

1.1.4 AbstractNamespace: copying

copyEmpty: newSize
Answer an empty copy of the receiver whose size is newSize


whileCurrentDo: aBlock
Evaluate aBlock with the current namespace set to the receiver. Answer the result of the evaluation.


Next: , Previous: AbstractNamespace-copying, Up: AbstractNamespace

1.1.5 AbstractNamespace: namespace hierarchy

addSubspace: aSymbol
Create a namespace named aSymbol, add it to the receiver's subspaces, and answer it.


allSubassociationsDo: aBlock
Invokes aBlock once for every association in each of the receiver's subspaces.


allSubspaces
Answer the direct and indirect subspaces of the receiver in a Set


allSubspacesDo: aBlock
Invokes aBlock for all subspaces, both direct and indirect.


allSuperspaces
Answer all the receiver's superspaces in a collection


allSuperspacesDo: aBlock
Evaluate aBlock once for each of the receiver's superspaces


includesClassNamed: aString
Answer whether the receiver or any of its superspaces include the given class – note that this method (unlike #includesKey:) does not require aString to be interned and (unlike #includesGlobalNamed:) only returns true if the global is a class object.


includesGlobalNamed: aString
Answer whether the receiver or any of its superspaces include the given key – note that this method (unlike #includesKey:) does not require aString to be interned but (unlike #includesClassNamed:) returns true even if the global is not a class object.


inheritsFrom: aNamespace
Answer whether aNamespace is one of the receiver's direct and indirect superspaces


removeSubspace: aSymbol
Remove my subspace named aSymbol from the hierarchy.


selectSubspaces: aBlock
Return a Set of subspaces of the receiver satisfying aBlock.


selectSuperspaces: aBlock
Return a Set of superspaces of the receiver satisfying aBlock.


siblings
Answer all the other children of the same namespace as the receiver.


siblingsDo: aBlock
Evaluate aBlock once for each of the other root namespaces, passing the namespace as a parameter.


subspaces
Answer the receiver's direct subspaces


subspacesDo: aBlock
Invokes aBlock for all direct subspaces.


superspace
Answer the receiver's superspace.


superspace: aNamespace
Set the superspace of the receiver to be 'aNamespace'. Also adds the receiver as a subspace of it.


withAllSubspaces
Answer a Set containing the receiver together with its direct and indirect subspaces


withAllSubspacesDo: aBlock
Invokes aBlock for the receiver and all subclasses, both direct and indirect.


withAllSuperspaces
Answer the receiver and all of its superspaces in a collection


withAllSuperspacesDo: aBlock
Invokes aBlock for the receiver and all superspaces, both direct and indirect.


Next: , Previous: AbstractNamespace-namespace hierarchy, Up: AbstractNamespace

1.1.6 AbstractNamespace: overrides for superspaces

definedKeys
Answer a kind of Set containing the keys of the receiver


definesKey: key
Answer whether the receiver defines the given key. `Defines' means that the receiver's superspaces, if any, are not considered.


hereAt: key
Return the value associated to the variable named as specified by `key' *in this namespace*. If the key is not found search will *not* be carried on in superspaces and the method will fail.


hereAt: key ifAbsent: aBlock
Return the value associated to the variable named as specified by `key' *in this namespace*. If the key is not found search will *not* be carried on in superspaces and aBlock will be immediately evaluated.


inheritedKeys
Answer a Set of all the keys in the receiver and its superspaces


set: key to: newValue
Assign newValue to the variable named as specified by `key'. This method won't define a new variable; instead if the key is not found it will search in superspaces and raising an error if the variable cannot be found in any of the superspaces. Answer newValue.


set: key to: newValue ifAbsent: aBlock
Assign newValue to the variable named as specified by `key'. This method won't define a new variable; instead if the key is not found it will search in superspaces and evaluate aBlock if it is not found. Answer newValue.


values
Answer a Bag containing the values of the receiver


Next: , Previous: AbstractNamespace-overrides for superspaces, Up: AbstractNamespace

1.1.7 AbstractNamespace: printing

name
Answer the receiver's name


name: aSymbol
Change the receiver's name to aSymbol


nameIn: aNamespace
Answer Smalltalk code compiling to the receiver when the current namespace is aNamespace


printOn: aStream
Print a representation of the receiver


storeOn: aStream
Store Smalltalk code compiling to the receiver


Previous: AbstractNamespace-printing, Up: AbstractNamespace

1.1.8 AbstractNamespace: testing

isNamespace
Answer `true'.


isSmalltalk
Answer `false'.


Next: , Previous: AbstractNamespace, Up: Base classes

1.2 AlternativeObjectProxy

Defined in namespace Smalltalk
Superclass: DumperProxy
Category: Streams-Files
I am a proxy that uses the same ObjectDumper to store an object which is not the object to be dumped, but from which the dumped object can be reconstructed. I am an abstract class, using me would result in infinite loops because by default I try to store the same object again and again. See the method comments for more information


Next: , Up: AlternativeObjectProxy

1.2.1 AlternativeObjectProxy class: instance creation

acceptUsageForClass: aClass
The receiver was asked to be used as a proxy for the class aClass. Answer whether the registration is fine. By default, answer true except if AlternativeObjectProxy itself is being used.


on: anObject
Answer a proxy to be used to save anObject. IMPORTANT: this method MUST be overridden so that the overridden version sends #on: to super passing an object that is NOT the same as anObject (alternatively, you can override #dumpTo:, which is what NullProxy does), because that would result in an infinite loop! This also means that AlternativeObjectProxy must never be used directly – only as a superclass.


Previous: AlternativeObjectProxy class-instance creation, Up: AlternativeObjectProxy

1.2.2 AlternativeObjectProxy: accessing

object
Reconstruct the object stored in the proxy and answer it. A subclass will usually override this


object: theObject
Set the object to be dumped to theObject. This should not be overridden.


primObject
Reconstruct the object stored in the proxy and answer it. This method must not be overridden


Next: , Previous: AlternativeObjectProxy, Up: Base classes

1.3 ArithmeticError

Defined in namespace Smalltalk
Superclass: Halt
Category: Language-Exceptions
An ArithmeticError exception is raised by numeric classes when a program tries to do something wrong, such as extracting the square root of a negative number.


Up: ArithmeticError

1.3.1 ArithmeticError: description

description
Answer a textual description of the exception.


Next: , Previous: ArithmeticError, Up: Base classes

1.4 Array

Defined in namespace Smalltalk
Superclass: ArrayedCollection
Category: Collections-Sequenceable
My instances are objects that have array-like properties: they are directly indexable by integers starting at 1, and they are fixed in size. I inherit object creation behavior messages such as #with:, as well as iteration and general access behavior from SequenceableCollection.


Next: , Up: Array

1.4.1 Array class: instance creation

from: anArray
Answer anArray, which is expected to be an array specified with a brace-syntax expression per my inherited protocol.


Next: , Previous: Array class-instance creation, Up: Array

1.4.2 Array: mutating objects

multiBecome: anArray
Transform every object in the receiver in each corresponding object in anArray. anArray and the receiver must have the same size


Next: , Previous: Array-mutating objects, Up: Array

1.4.3 Array: printing

isLiteralObject
Answer whether the receiver is expressible as a Smalltalk literal.


printOn: aStream
Print a representation for the receiver on aStream


storeLiteralOn: aStream
Store a Smalltalk literal compiling to the receiver on aStream


storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


Previous: Array-printing, Up: Array

1.4.4 Array: testing

isArray
Answer `true'.


Next: , Previous: Array, Up: Base classes

1.5 ArrayedCollection

Defined in namespace Smalltalk
Superclass: SequenceableCollection
Category: Collections-Sequenceable
My instances are objects that are generally fixed size, and are accessed by an integer index. The ordering of my instance's elements is determined externally; I will not rearrange the order of the elements.


Next: , Up: ArrayedCollection

1.5.1 ArrayedCollection class: instance creation

join: aCollection
Where aCollection is a collection of SequenceableCollections, answer a new instance with all the elements therein, in order.


join: aCollection separatedBy: sepCollection
Where aCollection is a collection of SequenceableCollections, answer a new instance with all the elements therein, in order, each separated by an occurrence of sepCollection.


new: size withAll: anObject
Answer a collection with the given size, whose elements are all set to anObject


streamContents: aBlock
Create a ReadWriteStream on an empty instance of the receiver; pass the stream to aBlock, then retrieve its contents and answer them.


with: element1
Answer a collection whose only element is element1


with: element1 with: element2
Answer a collection whose only elements are the parameters in the order they were passed


with: element1 with: element2 with: element3
Answer a collection whose only elements are the parameters in the order they were passed


with: element1 with: element2 with: element3 with: element4
Answer a collection whose only elements are the parameters in the order they were passed


with: element1 with: element2 with: element3 with: element4 with: element5
Answer a collection whose only elements are the parameters in the order they were passed


withAll: aCollection
Answer a collection whose elements are the same as those in aCollection


Next: , Previous: ArrayedCollection class-instance creation, Up: ArrayedCollection

1.5.2 ArrayedCollection: basic

, aSequenceableCollection
Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection


add: value
This method should not be called for instances of this class.


atAll: keyCollection
Answer a collection of the same kind returned by #collect:, that only includes the values at the given indices. Fail if any of the values in keyCollection is out of bounds for the receiver.


copyFrom: start to: stop
Answer a new collection containing all the items in the receiver from the start-th and to the stop-th


copyWith: anElement
Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by the single item anElement


copyWithout: oldElement
Answer a copy of the receiver to which all occurrences of oldElement are removed


Next: , Previous: ArrayedCollection-basic, Up: ArrayedCollection

1.5.3 ArrayedCollection: built ins

size
Answer the size of the receiver


Next: , Previous: ArrayedCollection-built ins, Up: ArrayedCollection

1.5.4 ArrayedCollection: copying Collections

copyReplaceAll: oldSubCollection with: newSubCollection
Answer a new collection in which all the sequences matching oldSubCollection are replaced with newSubCollection


copyReplaceFrom: start to: stop with: replacementCollection
Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index `start' to index `stop'.

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'.


copyReplaceFrom: start to: stop withObject: anObject
Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index `start' to index `stop'.

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'.


reverse
Answer the receivers' contents in reverse order


Next: , Previous: ArrayedCollection-copying Collections, Up: ArrayedCollection

1.5.5 ArrayedCollection: enumerating the elements of a collection

collect: aBlock
Answer a new instance of an ArrayedCollection containing all the results of evaluating aBlock passing each of the receiver's elements


reject: aBlock
Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer false


select: aBlock
Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer true


with: aSequenceableCollection collect: aBlock
Evaluate aBlock for each pair of elements took respectively from the re- ceiver and from aSequenceableCollection; answer a collection of the same kind of the receiver, made with the block's return values. Fail if the receiver has not the same size as aSequenceableCollection.


Next: , Previous: ArrayedCollection-enumerating the elements of a collection, Up: ArrayedCollection

1.5.6 ArrayedCollection: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


Previous: ArrayedCollection-storing, Up: ArrayedCollection

1.5.7 ArrayedCollection: streams

writeStream
Answer a WriteStream streaming on the receiver


Next: , Previous: ArrayedCollection, Up: Base classes

1.6 Association

Defined in namespace Smalltalk
Superclass: LookupKey
Category: Language-Data types
My instances represent a mapping between two objects. Typically, my "key" object is a symbol, but I don't require this. My "value" object has no conventions associated with it; it can be any object at all.


Next: , Up: Association

1.6.1 Association class: basic

key: aKey value: aValue
Answer a new association with the given key and value


Next: , Previous: Association class-basic, Up: Association

1.6.2 Association: accessing

environment
Answer nil. This is present to achieve polymorphism with instances of VariableBinding.


environment: aNamespace
Do nothing. This is present to achieve polymorphism with instances of VariableBinding.


key: aKey value: aValue
Set the association's key to aKey, and its value to aValue


value
Answer the association's value


value: aValue
Set the association's value to aValue


Next: , Previous: Association-accessing, Up: Association

1.6.3 Association: finalization

mourn
Finalize the receiver


Next: , Previous: Association-finalization, Up: Association

1.6.4 Association: printing

printOn: aStream
Put on aStream a representation of the receiver


Next: , Previous: Association-printing, Up: Association

1.6.5 Association: storing

storeOn: aStream
Put on aStream some Smalltalk code compiling to the receiver


Previous: Association-storing, Up: Association

1.6.6 Association: testing

= anAssociation
Answer whether the association's key and value are the same as anAssociation's, or false if anAssociation is not an Association. As a special case, identical values are considered equal even if #= returns false (as is the case for NaN floating-point values).


hash
Answer an hash value for the receiver


Next: , Previous: Association, Up: Base classes

1.7 Autoload

Defined in namespace Smalltalk
Superclass: none
Category: Examples-Useful tools
I am not a part of the normal Smalltalk kernel class system. I provide the ability to do late ("on-demand") loading of class definitions. Through me, you can define any class to be loaded when any message is sent to the class itself (such as to create an instance) or to its metaclass (such as #methodsFor: to extend it with class-side methods).


Next: , Up: Autoload

1.7.1 Autoload class: instance creation

class: nameSymbol from: fileNameString
Make Smalltalk automatically load the class named nameSymbol from fileNameString when needed


class: nameSymbol in: aNamespace from: fileNameString
Make Smalltalk automatically load the class named nameSymbol and residing in aNamespace from fileNameString when needed


Previous: Autoload class-instance creation, Up: Autoload

1.7.2 Autoload: accessing

class
We need it to access the metaclass instance, because that's what will load the file.


doesNotUnderstand: aMessage
Load the class and resend the message to it


Next: , Previous: Autoload, Up: Base classes

1.8 Bag

Defined in namespace Smalltalk
Superclass: Collection
Category: Collections-Unordered
My instances are unordered collections of objects. You can think of me as a set with a memory; that is, if the same object is added to me twice, then I will report that that element has been stored twice.


Next: , Up: Bag

1.8.1 Bag class: basic

new
Answer a new instance of the receiver


new: size
Answer a new instance of the receiver, with space for size distinct objects


Next: , Previous: Bag class-basic, Up: Bag

1.8.2 Bag: adding

add: newObject
Add an occurrence of newObject to the receiver. Answer newObject. Fail if newObject is nil.


add: newObject withOccurrences: anInteger
If anInteger > 0, add anInteger occurrences of newObject to the receiver. If anInteger < 0, remove them. Answer newObject. Fail if newObject is nil.


Next: , Previous: Bag-adding, Up: Bag

1.8.3 Bag: enumerating the elements of a collection

asSet
Answer a set with the elements of the receiver


do: aBlock
Evaluate the block for all members in the collection.


Next: , Previous: Bag-enumerating the elements of a collection, Up: Bag

1.8.4 Bag: extracting items

sortedByCount
Answer a collection of counts with elements, sorted by decreasing count.


Next: , Previous: Bag-extracting items, Up: Bag

1.8.5 Bag: printing

printOn: aStream
Put on aStream a representation of the receiver


Next: , Previous: Bag-printing, Up: Bag

1.8.6 Bag: removing

remove: oldObject ifAbsent: anExceptionBlock
Remove oldObject from the collection and return it. If can't be found, answer instead the result of evaluationg anExceptionBlock


Next: , Previous: Bag-removing, Up: Bag

1.8.7 Bag: storing

storeOn: aStream
Put on aStream some Smalltalk code compiling to the receiver


Previous: Bag-storing, Up: Bag

1.8.8 Bag: testing collections

= aBag
Answer whether the receiver and aBag contain the same objects


hash
Answer an hash value for the receiver


includes: anObject
Answer whether we include anObject


occurrencesOf: anObject
Answer the number of occurrences of anObject found in the receiver


size
Answer the total number of objects found in the receiver


Next: , Previous: Bag, Up: Base classes

1.9 Behavior

Defined in namespace Smalltalk
Superclass: Object
Category: Language-Implementation
I am the parent class of all "class" type methods. My instances know about the subclass/superclass relationships between classes, contain the description that instances are created from, and hold the method dictionary that's associated with each class. I provide methods for compiling methods, modifying the class inheritance hierarchy, examining the method dictionary, and iterating over the class hierarchy.


Next: , Up: Behavior

1.9.1 Behavior: accessing class hierarchy

allSubclasses
Answer the direct and indirect subclasses of the receiver in a Set


allSuperclasses
Answer all the receiver's superclasses in a collection


subclasses
Answer the direct subclasses of the receiver in a Set


superclass
Answer the receiver's superclass (if any, otherwise answer nil)


withAllSubclasses
Answer a Set containing the receiver together with its direct and indirect subclasses


withAllSuperclasses
Answer the receiver and all of its superclasses in a collection


Next: , Previous: Behavior-accessing class hierarchy, Up: Behavior

1.9.2 Behavior: accessing instances and variables

allClassVarNames
Return all the class variables understood by the receiver


allInstVarNames
Answer the names of every instance variables the receiver contained in the receiver's instances


allInstances
Returns a set of all instances of the receiver


allSharedPools
Return the names of the shared pools defined by the class and any of its superclasses


classPool
Answer the class pool dictionary. Since Behavior does not support classes with class variables, we answer an empty one; adding variables to it results in an error.


classVarNames
Answer all the class variables for instances of the receiver


instVarNames
Answer an Array containing the instance variables defined by the receiver


instanceCount
Return a count of all the instances of the receiver


sharedPools
Return the names of the shared pools defined by the class


subclassInstVarNames
Answer the names of the instance variables the receiver inherited from its superclass


Next: , Previous: Behavior-accessing instances and variables, Up: Behavior

1.9.3 Behavior: accessing the methodDictionary

>> selector
Return the compiled method associated with selector, from the local method dictionary. Error if not found.


allSelectors
Answer a Set of all the selectors understood by the receiver


compiledMethodAt: selector
Return the compiled method associated with selector, from the local method dictionary. Error if not found.


compiledMethodAt: selector ifAbsent: aBlock
Return the compiled method associated with selector, from the local method dictionary. Evaluate aBlock if not found.


lookupSelector: aSelector
Return the compiled method associated with selector, from the local method dictionary or one of a superclass; return nil if not found.


parseTreeFor: selector
Answer the parse tree for the given selector, or nil if there was an error. Requires the Parser package to be loaded.


selectorAt: method
Return selector for the given CompiledMethod


selectors
Answer a Set of the receiver's selectors


sourceCodeAt: selector
Answer source code (if available) for the given selector.


sourceMethodAt: selector
This is too dependent on the original implementation


Next: , Previous: Behavior-accessing the methodDictionary, Up: Behavior

1.9.4 Behavior: built ins

basicNewInFixedSpace
Create a new instance of a class with no indexed instance variables. The instance is guaranteed not to move across garbage collections. Like #basicNew, this method should not be overridden.


basicNewInFixedSpace: numInstanceVariables
Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables. The instance is guaranteed not to move across garbage collections. Like #basicNew:, this method should not be overridden.


flushCache
Invalidate the method cache kept by the virtual machine. This message should not need to be called by user programs.


methodsFor: category ifTrue: condition
Compile the following code inside the receiver, with the given category, if condition is true; else ignore it


primCompile: code
Compile the code, a string or readable stream, with no category. Fail if the code does not obey Smalltalk syntax. Answer the generated CompiledMethod if it does.

Do not send this in user code; use #compile: or related methods instead.


primCompile: code ifError: aBlock
As with #primCompile:, but evaluate aBlock (passing the file name, line number and description of the error) if the code does not obey Smalltalk syntax.

Do not send this in user code; use #compile:ifError: or related methods instead.


someInstance
Private - Answer the first instance of the receiver in the object table


Next: , Previous: Behavior-built ins, Up: Behavior

1.9.5 Behavior: builtin

basicNew
Create a new instance of a class with no indexed instance variables; this method must not be overridden.


basicNew: numInstanceVariables
Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables; this method must not be overridden.


new
Create a new instance of a class with no indexed instance variables


new: numInstanceVariables
Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables.


Next: , Previous: Behavior-builtin, Up: Behavior

1.9.6 Behavior: compilation (alternative)

methods
Don't use this, it's only present to file in from Smalltalk/V


methodsFor
Don't use this, it's only present to file in from Dolphin Smalltalk


methodsFor: category ifFeatures: features
Start compiling methods in the receiver if this implementation of Smalltalk has the given features, else skip the section


methodsFor: category stamp: notUsed
Don't use this, it's only present to file in from Squeak


privateMethods
Don't use this, it's only present to file in from IBM Smalltalk


publicMethods
Don't use this, it's only present to file in from IBM Smalltalk


Next: , Previous: Behavior-compilation (alternative), Up: Behavior

1.9.7 Behavior: compiling methods

methodsFor: aCategoryString
Calling this method prepares the parser to receive methods to be compiled and installed in the receiver's method dictionary. The methods are put in the category identified by the parameter.


Next: , Previous: Behavior-compiling methods, Up: Behavior

1.9.8 Behavior: creating a class hierarchy

addSubclass: aClass
Add aClass asone of the receiver's subclasses.


removeSubclass: aClass
Remove aClass from the list of the receiver's subclasses


superclass: aClass
Set the receiver's superclass.


Next: , Previous: Behavior-creating a class hierarchy, Up: Behavior

1.9.9 Behavior: enumerating

allInstancesDo: aBlock
Invokes aBlock for all instances of the receiver


allSubclassesDo: aBlock
Invokes aBlock for all subclasses, both direct and indirect.


allSubinstancesDo: aBlock
Invokes aBlock for all instances of each of the receiver's subclasses.


allSuperclassesDo: aBlock
Invokes aBlock for all superclasses, both direct and indirect.


selectSubclasses: aBlock
Return a Set of subclasses of the receiver satisfying aBlock.


selectSuperclasses: aBlock
Return a Set of superclasses of the receiver satisfying aBlock.


subclassesDo: aBlock
Invokes aBlock for all direct subclasses.


withAllSubclassesDo: aBlock
Invokes aBlock for the receiver and all subclasses, both direct and indirect.


withAllSuperclassesDo: aBlock
Invokes aBlock for the receiver and all superclasses, both direct and indirect.


Next: , Previous: Behavior-enumerating, Up: Behavior

1.9.10 Behavior: evaluating

evalString: aString to: anObject
Answer the stack top at the end of the evaluation of the code in aString. The code is executed as part of anObject


evalString: aString to: anObject ifError: aBlock
Answer the stack top at the end of the evaluation of the code in aString. If aString cannot be parsed, evaluate aBlock (see compile:ifError:). The code is executed as part of anObject


evaluate: code
Evaluate Smalltalk expression in 'code' and return result.


evaluate: code ifError: block
Evaluate 'code'. If a parsing error is detected, invoke 'block'


evaluate: code notifying: requestor
Evaluate Smalltalk expression in 'code'. If a parsing error is encountered, send #error: to requestor


evaluate: code to: anObject
Evaluate Smalltalk expression as part of anObject's method definition


evaluate: code to: anObject ifError: block
Evaluate Smalltalk expression as part of anObject's method definition. This method is used to support Inspector expression evaluation. If a parsing error is encountered, invoke error block, 'block'


Next: , Previous: Behavior-evaluating, Up: Behavior

1.9.11 Behavior: instance creation

newInFixedSpace
Create a new instance of a class without indexed instance variables. The instance is guaranteed not to move across garbage collections. If a subclass overrides #new, the changes will apply to this method too.


newInFixedSpace: numInstanceVariables
Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables. The instance is guaranteed not to move across garbage collections. If a subclass overrides #new:, the changes will apply to this method too.


Next: , Previous: Behavior-instance creation, Up: Behavior

1.9.12 Behavior: instance variables

addInstVarName: aString
Add the given instance variable to instance of the receiver


instanceVariableNames: instVarNames
Set the instance variables for the receiver to be those in instVarNames


removeInstVarName: aString
Remove the given instance variable from the receiver and recompile all of the receiver's subclasses


Next: , Previous: Behavior-instance variables, Up: Behavior

1.9.13 Behavior: method dictionary

addSelector: selector withMethod: compiledMethod
Add the given compiledMethod to the method dictionary, giving it the passed selector. Answer compiledMethod


compile: code
Compile method source. If there are parsing errors, answer nil. Else, return a CompiledMethod result of compilation


compile: code ifError: block
Compile method source. If there are parsing errors, invoke exception block, 'block' passing file name, line number and error. Return a CompiledMethod result of compilation

to

compile: code notifying: requestor
Compile method source. If there are parsing errors, send #error: to the requestor object, else return a CompiledMethod result of compilation


compileAll
Recompile all selectors in the receiver. Ignore errors.


compileAll: aNotifier
Recompile all selectors in the receiver. Notify aNotifier by sen- ding #error: messages if something goes wrong.


compileAllSubclasses
Recompile all selector of all subclasses. Notify aNotifier by sen- ding #error: messages if something goes wrong.


compileAllSubclasses: aNotifier
Recompile all selector of all subclasses. Notify aNotifier by sen- ding #error: messages if something goes wrong.


createGetMethod: what
Create a method accessing the variable `what'.


createGetMethod: what default: value
Create a method accessing the variable `what', with a default value of `value', using lazy initialization


createSetMethod: what
Create a method which sets the variable `what'.


decompile: selector
Decompile the bytecodes for the given selector.


defineAsyncCFunc: cFuncNameString withSelectorArgs: selectorAndArgs args: argsArray
Please lookup the part on the C interface in the manual. This method is deprecated, you should use the asyncCCall:args: attribute.


defineCFunc: cFuncNameString withSelectorArgs: selectorAndArgs returning: returnTypeSymbol args: argsArray
Please lookup the part on the C interface in the manual. This method is deprecated, you should use the cCall:returning:args: attribute.


edit: selector
Open Emacs to edit the method with the passed selector, then compile it


methodDictionary
Answer the receiver's method dictionary. Don't modify the method dictionary unless you exactly know what you're doing


methodDictionary: aDictionary
Set the receiver's method dictionary to aDictionary


recompile: selector
Recompile the given selector, answer nil if something goes wrong or the new CompiledMethod if everything's ok.

to

recompile: selector notifying: aNotifier
Recompile the given selector. If there are parsing errors, send #error: to the aNotifier object, else return a CompiledMethod result of compilation


removeSelector: selector
Remove the given selector from the method dictionary, answer the CompiledMethod attached to that selector


removeSelector: selector ifAbsent: aBlock
Remove the given selector from the method dictionary, answer the CompiledMethod attached to that selector. If the selector cannot be found, answer the result of evaluating aBlock.


selectorsAndMethodsDo: aBlock
Evaluate aBlock, passing for each evaluation a selector that's defined in the receiver and the corresponding method.


Next: , Previous: Behavior-method dictionary, Up: Behavior

1.9.14 Behavior: parsing class declarations

parseInstanceVariableString: variableString
Not commented.


parseVariableString: aString
Not commented.


Next: , Previous: Behavior-parsing class declarations, Up: Behavior

1.9.15 Behavior: pluggable behavior (not yet implemented)

compilerClass
Answer the class that can be used to compile parse trees, or nil if there is none (as is the case now). Not used for methods if parserClass answers nil, and for doits if evaluatorClass answers nil.


debuggerClass
Answer which class is to be used to debug a chain of contexts which includes the receiver. nil means 'do not debug'; other classes are sent #debuggingPriority and the one with the highest priority is picked.


decompilerClass
Answer the class that can be used to decompile methods, or nil if there is none (as is the case now).


evaluatorClass
Answer the class that can be used to evaluate doits, or nil if there is none (as is the case now).


parserClass
Answer the class that can be used to parse methods, or nil if there is none (as is the case now).


Next: , Previous: Behavior-pluggable behavior (not yet implemented), Up: Behavior

1.9.16 Behavior: printing hierarchy

hierarchyIndent
Answer the indent to be used by #printHierarchy - 4 by default


printHierarchy
Print my entire subclass hierarchy on the terminal.


printSubclasses: level using: aBlock
I print my name, and then all my subclasses, each indented according to its position in the hierarchy. I pass aBlock a class name and a level


Next: , Previous: Behavior-printing hierarchy, Up: Behavior

1.9.17 Behavior: still unclassified

parseNodeAt: selector
Not commented.


updateInstanceVars: variableArray shape: shape
Update instance variables and instance spec of the class and all its subclasses. variableArray lists the new variables, including inherited ones.


Next: , Previous: Behavior-still unclassified, Up: Behavior

1.9.18 Behavior: support for lightweight classes

article
Answer an article (`a' or `an') which is ok for the receiver's name


asClass
Answer the first superclass that is a full-fledged Class object


environment
Answer the namespace that this class belongs to - the same as the superclass, since Behavior does not support namespaces yet.


name
Answer the class name; this prints to the name of the superclass enclosed in braces. This class name is used, for example, to print the receiver.


nameIn: aNamespace
Answer the class name when the class is referenced from aNamespace - a dummy one, since Behavior does not support names.


printOn: aStream in: aNamespace
Answer the class name when the class is referenced from aNamespace - a dummy one, since Behavior does not support names.


securityPolicy
Not commented.


securityPolicy: aSecurityPolicy
This method should not be called for instances of this class.


Next: , Previous: Behavior-support for lightweight classes, Up: Behavior

1.9.19 Behavior: testing functionality

isBehavior
Answer `true'.


Next: , Previous: Behavior-testing functionality, Up: Behavior

1.9.20 Behavior: testing the class hierarchy

includesBehavior: aClass
Returns true if aClass is the receiver or a superclass of the receiver.


inheritsFrom: aClass
Returns true if aClass is a superclass of the receiver


kindOfSubclass
Return a string indicating the type of class the receiver is


shape
Not commented.

#ushort

shape: shape
Give the provided shape to the receiver's instances. The shape can be nil, or one of #byte #int8 #character #short #word #ushort #int #uint #int64 #uint64 #utf32 #float #double or #pointer. In addition, the special value #inherit means to use the shape of the superclass; note however that this is a static setting, and subclasses that used #inherit are not mutated when the superclass adopts a different shape.


shapes
Not commented.


Next: , Previous: Behavior-testing the class hierarchy, Up: Behavior

1.9.21 Behavior: testing the form of the instances

instSize
Answer how many fixed instance variables are reserved to each of the receiver's instances


isBits
Not commented.


isFixed
Answer whether the receiver's instances have no indexed instance variables


isIdentity
Answer whether x = y implies x == y for instances of the receiver


isImmediate
Answer whether, if x is an instance of the receiver, x copy == x


isPointers
Answer whether the instance variables of the receiver's instances are objects


isVariable
Answer whether the receiver's instances have indexed instance variables


Previous: Behavior-testing the form of the instances, Up: Behavior

1.9.22 Behavior: testing the method dictionary

canUnderstand: selector
Returns true if the instances of the receiver understand the given selector


hasMethods
Return whether the receiver has any methods defined


includesSelector: selector
Returns true if the local method dictionary contains the given selector


scopeHas: name ifTrue: aBlock
If methods understood by the receiver's instances have access to a symbol named 'name', evaluate aBlock


whichClassIncludesSelector: selector
Answer which class in the receiver's hierarchy contains the implementation of selector used by instances of the class (nil if none does)


whichSelectorsAccess: instVarName
Answer a Set of selectors which access the given instance variable


whichSelectorsAssign: instVarName
Answer a Set of selectors which read the given instance variable


whichSelectorsRead: instVarName
Answer a Set of selectors which read the given instance variable


whichSelectorsReferTo: anObject
Returns a Set of selectors that refer to anObject


whichSelectorsReferToByteCode: aByteCode
Return the collection of selectors in the class which reference the byte code, aByteCode


Next: , Previous: Behavior, Up: Base classes

1.10 BindingDictionary

Defined in namespace Smalltalk
Superclass: Dictionary
Category: Language-Implementation
I am a special form of dictionary that provides special ways to access my keys, which typically begin with an uppercase letter; also, my associations are actually VariableBinding instances.

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.


Next: , Up: BindingDictionary

1.10.1 BindingDictionary: accessing

define: aSymbol
Define aSymbol as equal to nil inside the receiver. Fail if such a variable already exists (use #at:put: if you don't want to fail)


doesNotUnderstand: aMessage
Try to map unary selectors to read accesses to the Namespace, and one-argument keyword selectors to write accesses. Note that: a) this works only if the selector has an uppercase first letter; and b) `aNamespace Variable: value' is the same as `aNamespace set: #Variable to: value', not the same as `aNamespace at: #Variable put: value' — the latter always refers to the current namespace, while the former won't define a new variable, instead searching in superspaces (and raising an error if the variable cannot be found).


environment
Answer the environment to which the receiver is connected. This can be the class for a dictionary that holds class variables, or the super-namespace. In general it is used to compute the receiver's name.


environment: anObject
Set the environment to which the receiver is connected. This can be the class for a dictionary that holds class variables, or the super-namespace. In general it is used to compute the receiver's name.


import: aSymbol from: aNamespace
Add to the receiver the symbol aSymbol, associated to the same value as in aNamespace. Fail if aNamespace does not contain the given key.


name
Answer the receiver's name, which by default is the same as the name of the receiver's environment.


nameIn: aNamespace
Answer the receiver's name when referred to from aNamespace; by default the computation is deferred to the receiver's environment.


Next: , Previous: BindingDictionary-accessing, Up: BindingDictionary

1.10.2 BindingDictionary: copying

copy
Answer the receiver.


copyEmpty: newSize
Answer an empty copy of the receiver whose size is newSize


copyEmptyForCollect
Answer an empty copy of the receiver which is filled in to compute the result of #collect:


copyEmptyForCollect: size
Answer an empty copy of the receiver which is filled in to compute the result of #collect:


deepCopy
Answer the receiver.


shallowCopy
Answer the receiver.


Next: , Previous: BindingDictionary-copying, Up: BindingDictionary

1.10.3 BindingDictionary: forward declarations

at: key put: value
Store value as associated to the given key. If any, recycle Associations temporarily stored by the compiler inside the `Undeclared' dictionary.


Next: , Previous: BindingDictionary-forward declarations, Up: BindingDictionary

1.10.4 BindingDictionary: printing

printOn: aStream in: aNamespace
Print the receiver's name when referred to from aNamespace; by default the computation is deferred to the receiver's environment.


Previous: BindingDictionary-printing, Up: BindingDictionary

1.10.5 BindingDictionary: testing

species
Answer `IdentityDictionary'.


Next: , Previous: BindingDictionary, Up: Base classes

1.11 BlockClosure

Defined in namespace Smalltalk
Superclass: Object
Category: Language-Implementation
I am a factotum class. My instances represent Smalltalk blocks, portions of executeable code that have access to the environment that they were declared in, take parameters, and can be passed around as objects to be executed by methods outside the current class. Block closures are sent a message to compute their value and create a new execution context; this property can be used in the construction of control flow methods. They also provide some methods that are used in the creation of Processes from blocks.


Next: , Up: BlockClosure

1.11.1 BlockClosure class: instance creation

block: aCompiledBlock
Answer a BlockClosure that activates the passed CompiledBlock.


block: aCompiledBlock receiver: anObject
Answer a BlockClosure that activates the passed CompiledBlock with the given receiver.


block: aCompiledBlock receiver: anObject outerContext: aContext
Answer a BlockClosure that activates the passed CompiledBlock with the given receiver.


exceptionHandlerResetBlock
Not commented.


exceptionHandlerSearchBlock
Not commented.


numArgs: args numTemps: temps bytecodes: bytecodes depth: depth literals: literalArray
Answer a BlockClosure for a new CompiledBlock that is created using the passed parameters. To make it work, you must put the BlockClosure into a CompiledMethod's literals.


Next: , Previous: BlockClosure class-instance creation, Up: BlockClosure

1.11.2 BlockClosure class: testing

isImmediate
Answer whether, if x is an instance of the receiver, x copy == x


Next: , Previous: BlockClosure class-testing, Up: BlockClosure

1.11.3 BlockClosure: accessing

argumentCount
Answer the number of arguments passed to the receiver


block
Answer the CompiledBlock which contains the receiver's bytecodes


block: aCompiledBlock
Set the CompiledBlock which contains the receiver's bytecodes


finalIP
Answer the last instruction that can be executed by the receiver


fixTemps
This should fix the values of the temporary variables used in the block that are ordinarily shared with the method in which the block is defined. Not defined yet, but it is not harmful that it isn't. Answer the receiver.


initialIP
Answer the initial instruction pointer into the receiver.


method
Answer the CompiledMethod in which the receiver lies


numArgs
Answer the number of arguments passed to the receiver


numTemps
Answer the number of temporary variables used by the receiver


outerContext
Answer the method/block context which is the immediate outer of the receiver


outerContext: containingContext
Set the method/block context which is the immediate outer of the receiver


receiver
Answer the object that is used as `self' when executing the receiver (if nil, it might mean that the receiver is not valid though...)


receiver: anObject
Set the object that is used as `self' when executing the receiver


stackDepth
Answer the number of stack slots needed for the receiver


Next: , Previous: BlockClosure-accessing, Up: BlockClosure

1.11.4 BlockClosure: built ins

value
Evaluate the receiver passing no parameters


value: arg1
Evaluate the receiver passing arg1 as the only parameter


value: arg1 value: arg2
Evaluate the receiver passing arg1 and arg2 as the parameters


value: arg1 value: arg2 value: arg3
Evaluate the receiver passing arg1, arg2 and arg3 as the parameters


valueWithArguments: argumentsArray
Evaluate the receiver passing argArray's elements as the parameters


Next: , Previous: BlockClosure-built ins, Up: BlockClosure

1.11.5 BlockClosure: control structures

repeat
Evaluate the receiver 'forever' (actually until a return is executed or the process is terminated).


whileFalse
Evaluate the receiver until it returns true


whileFalse: aBlock
Evaluate the receiver. If it returns false, evaluate aBlock and re- start


whileTrue
Evaluate the receiver until it returns false


whileTrue: aBlock
Evaluate the receiver. If it returns true, evaluate aBlock and re- s