Category: Language-Implementation
Superclass: Object
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.

Method category index

accessing class hierarchy (instance)
accessing instances and variables (instance)
accessing the method dictionary (instance)
built ins (instance)
builtin (instance)
compilation (instance)
compilation (alternative) (instance)
compiling (instance)
compiling methods (instance)
creating a class hierarchy (instance)
enumerating (instance)
evaluating (instance)
instance creation (instance)
instance variables (instance)
method dictionary (instance)
parsing (instance)
parsing class declarations (instance)
pluggable behavior (not yet implemented) (instance)
printing hierarchy (instance)
source code (instance)
still unclassified (instance)
support for lightweight classes (instance)
testing functionality (instance)
testing the class hierarchy (instance)
testing the form of the instances (instance)
testing the method dictionary (instance)

accessing class hierarchy (instance)

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

top


accessing instances and variables (instance)

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

allSharedPoolDictionaries

Return the shared pools defined by the class and any of its superclasses, in the correct search order.

allSharedPools

Return the names of the shared pools defined by the class and any of its superclasses, in the correct search order.

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

indexOfInstVar: aString

Answer the index of aString in the fixed instance variables of the instances of the receiver, or 0 if the variable is missing.

indexOfInstVar: aString ifAbsent: aBlock

Answer the index of aString in the fixed instance variables of the instances of the receiver, or 0 if the variable is missing.

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

top


accessing the method dictionary (instance)

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

formattedSourceStringAt: selector

Answer the method source code as a formatted string (if available) for the given selector. Requires package Parser.

lookupAllSelectors: aSelector

Answer a Set of all the compiled method associated with selector. from the local method dictionary and all of the superclasses.

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.

sourceCodeAt: selector ifAbsent: aBlock

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

sourceMethodAt: selector

This is too dependent on the original implementation

top


built ins (instance)

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

top


builtin (instance)

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.

top


compilation (instance)

scopeDictionary
Answer the dictionary that is used when the receiver is before a period in Smalltalk source code.

top


compilation (alternative) (instance)

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

top


compiling (instance)

compilerClass
Return the class that will be used to compile the parse nodes into bytecodes.

top


compiling methods (instance)

poolResolution
Answer a PoolResolution class to be used for resolving pool variables while compiling methods on this class.

top


creating a class hierarchy (instance)

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.

top


enumerating (instance)

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.

top


evaluating (instance)

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'

top


instance creation (instance)

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.

top


instance variables (instance)

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

top


method dictionary (instance)

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

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 sending #error: messages if something goes wrong.

compileAllSubclasses

Recompile all selector of all subclasses. Notify aNotifier by sending #error: messages if something goes wrong.

compileAllSubclasses: aNotifier

Recompile all selector of all subclasses. Notify aNotifier by sending #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.

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.

top


parsing (instance)

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.

top


parsing class declarations (instance)

parseInstanceVariableString: variableString
As with #parseVariableString:, but answer symbols that name the variables instead of strings.

parseVariableString: aString

Answer an array of instance variable names. aString should specify these in traditional file-in `instanceVariableNames' format. Signal an error if aString contains something other than valid Smalltalk variables.

top


pluggable behavior (not yet implemented) (instance)

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

top


printing hierarchy (instance)

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

printFullHierarchy

Print my full hierarchy (i.e. all my superclasses and subclasses) on the terminal.

printHierarchy

Print my entire subclass hierarchy on the terminal.

top


source code (instance)

formattedSourceStringAt: aSelector ifAbsent: aBlock
Answer the method source code as a formatted string. Requires package Parser.

top


still unclassified (instance)

allSharedPoolDictionariesDo: aBlock
Answer the shared pools visible from methods in the metaclass, in the correct search order.

parseNodeAt: selector

Available only when the Parser package is loaded--Answer an RBMethodNode that compiles to my method named by selector.

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.

top


support for lightweight classes (instance)

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.

top


testing functionality (instance)

isBehavior
Answer `true'.

top


testing the class hierarchy (instance)

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

Answer the symbolic shape of my instances.

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.

top


testing the form of the instances (instance)

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

isBits

Answer whether my instances' variables are immediate, non-OOP values.

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

top


testing the method dictionary (instance)

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

top