Squeak Class Documentation category index | class index  
 
Behavior
  category: Kernel-Classes
  superclass: Object
  subclasses: ClassDescription Oop Unsigned

My instances describe the behavior of other objects. I provide the minimum state necessary for compiling methods, and creating and running instances. Most objects are created as instances of the more fully supported subclass, Class, but I am a good starting point for providing instance-specific behavior (as in Metaclass).

instance methods
  Camp Smalltalk
  sunitAllSelectors
sunitSelectors

  accessing
  compilerClass
confirmRemovalOf:
decompilerClass
environment
evaluatorClass
format
methodDict
name
parserClass
sourceCodeTemplate
subclassDefinerClass
typeOfClass

  accessing class hierarchy
  allSelectorsUnderstood
allSubclassesWithLevelDo:startingLevel:
allSuperclasses
superclass
withAllSuperclasses

  accessing instances and variables
  allClassVarNames
allInstVarNames
allInstances
allSharedPools
allSubInstances
classVarNames
inspectAllInstances
inspectSubInstances
instVarNames
instanceCount
sharedPools
someInstance
subclassInstVarNames

  accessing method dictionary
  >>
allSelectors
changeRecordsAt:
compiledMethodAt:
compiledMethodAt:ifAbsent:
compressedSourceCodeAt:
firstCommentAt:
firstPrecodeCommentFor:
formalHeaderPartsFor:
formalParametersAt:
lookupSelector:
methodHeaderFor:
methodsDo:
positionOfFirstCommentAt:
precodeCommentOrInheritedCommentFor:
rootStubInImageSegment:
selectorAtMethod:setClass:
selectors
selectorsAndMethodsDo:
selectorsDo:
selectorsWithArgs:
sourceCodeAt:
sourceCodeAt:ifAbsent:
sourceMethodAt:
sourceMethodAt:ifAbsent:
supermostPrecodeCommentFor:

  copying
  copy
copyOfMethodDictionary
deepCopy

  creating class hierarchy
  superclass:

  creating method dictionary
  addSelector:withMethod:
compile:
compile:notifying:
compileAll
compileAllFrom:
compress
decompile:
defaultSelectorForMethod:
methodDictionary
methodDictionary:
recompile:
recompile:from:
recompileChanges
recompileNonResidentMethod:atSelector:from:
removeSelector:

  enumerating
  allInstancesDo:
allInstancesEverywhereDo:
allSubInstancesDo:
allSubclassesDo:
allSubclassesDoGently:
allSuperclassesDo:
selectSubclasses:
selectSuperclasses:
withAllSubclassesDo:
withAllSuperAndSubclassesDoGently:
withAllSuperclassesDo:

  initialize-release
  forgetDoIts
nonObsoleteClass
obsolete
superclass:methodDictionary:format:

  instance creation
  basicNew
basicNew:
initializedInstance
new
new:

  obsolete subclasses
  addObsoleteSubclass:
obsoleteSubclasses

  printing
  defaultNameStemForInstances
literalScannedAs:notifying:
longPrintOn:
printHierarchy
printOn:
printOnStream:
storeLiteral:on:

  private
  becomeCompact
becomeCompactSimplyAt:
becomeUncompact
flushCache
indexIfCompact
removeSelectorSimply:

  system startup
  shutDown
shutDown:
startUp
startUp:
startUpFrom:

  testing
  canZapMethodDictionary
fullyImplementsVocabulary:
implementsVocabulary:
instSize
instSpec
isBehavior
isBits
isBytes
isFixed
isObsolete
isPointers
isVariable
isWeak
isWords
shouldNotBeRedefined

  testing class hierarchy
  includesBehavior:
inheritsFrom:
kindOfSubclass

  testing method dictionary
  allUnsentMessages
canUnderstand:
classThatUnderstands:
hasMethods
includesSelector:
scopeHas:ifTrue:
thoroughWhichSelectorsReferTo:special:byte:
whichClassIncludesSelector:
whichSelectorsAccess:
whichSelectorsReferTo:
whichSelectorsReferTo:special:byte:
whichSelectorsStoreInto:

  user interface
  allCallsOn:
allLocalCallsOn:
allUnreferencedInstanceVariables
browse
browseAllAccessesTo:
browseAllCallsOn:
browseAllStoresInto:
crossReference
unreferencedInstanceVariables
withAllSubAndSuperclassesDo:

class methods
  class initialization
  flushObsoleteSubclasses
initialize
initializeObsoleteSubclasses

  testing
  canZapMethodDictionary

instance methods
  Camp Smalltalk top  
 

sunitAllSelectors


 

sunitSelectors


  accessing top  
 

compilerClass

Answer a compiler class appropriate for source methods of this class.


 

confirmRemovalOf:

Determine if it is okay to remove the given selector. Answer 1 if it should be removed, 2 if it should be removed followed by a senders browse, and 3 if it should not be removed.


 

decompilerClass

Answer a decompiler class appropriate for compiled methods of this class.


 

environment

Return the environment in which the receiver is visible


 

evaluatorClass

Answer an evaluator class appropriate for evaluating expressions in the
context of this class.


 

format

Answer an Integer that encodes the kinds and numbers of variables of
instances of the receiver.


 

methodDict


 

name

Answer a String that is the name of the receiver.


 

parserClass

Answer a parser class to use for parsing method headers.


 

sourceCodeTemplate

Answer an expression to be edited and evaluated in order to define
methods in this class.


 

subclassDefinerClass

Answer an evaluator class appropriate for evaluating definitions of new
subclasses of this class.


 

typeOfClass

Answer a symbol uniquely describing the type of the receiver


  accessing class hierarchy top  
 

allSelectorsUnderstood

Answer a list of all selectors understood by instances of the receiver


 

allSubclassesWithLevelDo:startingLevel:

Walk the tree of subclasses, giving the class and its level


 

allSuperclasses

Answer an OrderedCollection of the receiver's and the receiver's
ancestor's superclasses. The first element is the receiver's immediate
superclass, followed by its superclass; the last element is Object.


 

superclass

Answer the receiver's superclass, a Class.


 

withAllSuperclasses

Answer an OrderedCollection of the receiver and the receiver's
superclasses. The first element is the receiver,
followed by its superclass; the last element is Object.


  accessing instances and variables top  
 

allClassVarNames

Answer a Set of the names of the receiver's and the receiver's ancestor's
class variables.


 

allInstVarNames

Answer an Array of the names of the receiver's instance variables. The
Array ordering is the order in which the variables are stored and
accessed by the interpreter.


 

allInstances

Answer a collection of all current instances of the receiver.


 

allSharedPools

Answer a Set of the names of the pools (Dictionaries) that the receiver
and the receiver's ancestors share.


 

allSubInstances

Answer a list of all current instances of the receiver and all of its subclasses.


 

classVarNames

Answer a Set of the receiver's class variable names.


 

inspectAllInstances

Inpsect all instances of the receiver. 1/26/96 sw


 

inspectSubInstances

Inspect all instances of the receiver and all its subclasses. CAUTION - don't do this for something as generic as Object! 1/26/96 sw


 

instVarNames

Answer an Array of the instance variable names. Behaviors must make
up fake local instance variable names because Behaviors have instance
variables for the purpose of compiling methods, but these are not named
instance variables.


 

instanceCount

Answer the number of instances of the receiver that are currently in
use.


 

sharedPools

Answer a Set of the names of the pools (Dictionaries) that the receiver
shares.
9/12/96 tk sharedPools have an order now


 

someInstance

Primitive. Answer the first instance in the enumeration of all instances
of the receiver. Fails if there are none. Essential. See Object
documentation whatIsAPrimitive.


 

subclassInstVarNames

Answer a Set of the names of the receiver's subclasses' instance
variables.


  accessing method dictionary top  
 

>>

Answer the compiled method associated with the argument, selector (a
Symbol), a message selector in the receiver's method dictionary. If the
selector is not in the dictionary, create an error notification.


 

allSelectors

Answer a Set of all the message selectors that instances of the receiver
can understand.


 

changeRecordsAt:

Return a list of ChangeRecords for all versions of the method at selector. Source code can be retrieved by sending string to any one. Return nil if the method is absent.


 

compiledMethodAt:

Answer the compiled method associated with the argument, selector (a
Symbol), a message selector in the receiver's method dictionary. If the
selector is not in the dictionary, create an error notification.


 

compiledMethodAt:ifAbsent:

Answer the compiled method associated with the argument, selector (a Symbol), a message selector in the receiver's method dictionary. If the selector is not in the dictionary, return the value of aBlock


 

compressedSourceCodeAt:

(Paragraph compressedSourceCodeAt: #displayLines:affectedRectangle:) size 721 1921
Paragraph selectors inject: 0 into: [:tot :sel | tot + (Paragraph compressedSourceCodeAt: sel) size] 13606 31450


 

firstCommentAt:

Answer a string representing the first comment in the method associated with selector. Return an empty string if the relevant source file is not available, or if the method's source code does not contain a comment. Not smart enough to bypass quotes in string constants, but does map doubled quote into a single quote.


 

firstPrecodeCommentFor:

If there is a comment in the source code at the given selector that preceeds the body of the method, return it here, else return nil


 

formalHeaderPartsFor:

popeye


 

formalParametersAt:

Return the names of the arguments used in this method.


 

lookupSelector:

Look up the given selector in my methodDictionary.
Return the corresponding method if found.
Otherwise chase the superclass chain and try again.
Return nil if no method is found.


 

methodHeaderFor:

Answer the string corresponding to the method header for the given selector


 

methodsDo:

Evaluate aBlock for all the compiled methods in my method dictionary.


 

positionOfFirstCommentAt:

Answer the position in the source string associated with aSelector of the first comment therein, or an empty string if none


 

precodeCommentOrInheritedCommentFor:

Answer a string representing the first comment in the method associated with selector, considering however only comments that occur before the beginning of the actual code. If the version recorded in the receiver is uncommented, look up the inheritance chain. Return nil if none found.


 

rootStubInImageSegment:


 

selectorAtMethod:setClass:

Answer both the message selector associated with the compiled method
and the class in which that selector is defined.


 

selectors

Answer a Set of all the message selectors specified in the receiver's
method dictionary.


 

selectorsAndMethodsDo:

Evaluate selectorBlock for all the message selectors in my method dictionary.


 

selectorsDo:

Evaluate selectorBlock for all the message selectors in my method dictionary.


 

selectorsWithArgs:

Return all selectors defined in this class that take this number of arguments. Could use String.keywords. Could see how compiler does this.


 

sourceCodeAt:


 

sourceCodeAt:ifAbsent:


 

sourceMethodAt:

Answer the paragraph corresponding to the source code for the
argument.


 

sourceMethodAt:ifAbsent:

Answer the paragraph corresponding to the source code for the
argument.


 

supermostPrecodeCommentFor:

Answer a string representing the precode comment in the most distant superclass's implementation of the selector. Return nil if none found.


  copying top  
 

copy

Answer a copy of the receiver without a list of subclasses.


 

copyOfMethodDictionary

Return a copy of the receiver's method dictionary


 

deepCopy

Classes should only be shallowCopied or made anew.


  creating class hierarchy top  
 

superclass:

Change the receiver's superclass to be aClass.


  creating method dictionary top  
 

addSelector:withMethod:

Add the message selector with the corresponding compiled method to the
receiver's method dictionary.


 

compile:

Compile the argument, code, as source code in the context of the
receiver. Create an error notification if the code can not be compiled.
The argument is either a string or an object that converts to a string or a
PositionableStream on an object that converts to a string.


 

compile:notifying:

Compile the argument, code, as source code in the context of the
receiver and insEtall the result in the receiver's method dictionary. The
second argument, requestor, is to be notified if an error occurs. The
argument code is either a string or an object that converts to a string or
a PositionableStream. This method also saves the source code.


 

compileAll


 

compileAllFrom:

Compile all the methods in the receiver's method dictionary.
This validates sourceCode and variable references and forces
all methods to use the current bytecode set


 

compress

Compact the method dictionary of the receiver.


 

decompile:

Find the compiled code associated with the argument, selector, as a
message selector in the receiver's method dictionary and decompile it.
Answer the resulting source code as a string. Create an error notification
if the selector is not in the receiver's method dictionary.


 

defaultSelectorForMethod:

Given a method, invent and answer an appropriate message selector (a
Symbol), that is, one that will parse with the correct number of
arguments.


 

methodDictionary

Convenience


 

methodDictionary:

Store the argument, aDictionary, as the method dictionary of the
receiver.


 

recompile:

Compile the method associated with selector in the receiver's method dictionary.


 

recompile:from:

Compile the method associated with selector in the receiver's method dictionary.


 

recompileChanges

Compile all the methods that are in the changes file.
This validates sourceCode and variable references and forces
methods to use the current bytecode set


 

recompileNonResidentMethod:atSelector:from:

Recompile the method supplied in the context of this class.


 

removeSelector:

Assuming that the argument, selector (a Symbol), is a message selector
in my method dictionary, remove it and its method.


  enumerating top  
 

allInstancesDo:

Evaluate the argument, aBlock, for each of the current instances of the
receiver.


 

allInstancesEverywhereDo:

Evaluate the argument, aBlock, for each of the current instances of the receiver. Including those in ImageSegments that are out on the disk. Bring each in briefly.


 

allSubInstancesDo:

Evaluate the argument, aBlock, for each of the current instances of the
receiver and all its subclasses.


 

allSubclassesDo:

Evaluate the argument, aBlock, for each of the receiver's subclasses.


 

allSubclassesDoGently:

Evaluate the argument, aBlock, for each of the receiver's subclasses.


 

allSuperclassesDo:

Evaluate the argument, aBlock, for each of the receiver's superclasses.


 

selectSubclasses:

Evaluate the argument, aBlock, with each of the receiver's (next level)
subclasses as its argument. Collect into a Set only those subclasses for
which aBlock evaluates to true. In addition, evaluate aBlock for the
subclasses of each of these successful subclasses and collect into the set
those for which aBlock evaluates true. Answer the resulting set.


 

selectSuperclasses:

Evaluate the argument, aBlock, with the receiver's superclasses as the
argument. Collect into an OrderedCollection only those superclasses for
which aBlock evaluates to true. In addition, evaluate aBlock for the
superclasses of each of these successful superclasses and collect into the
OrderedCollection ones for which aBlock evaluates to true. Answer the
resulting OrderedCollection.


 

withAllSubclassesDo:

Evaluate the argument, aBlock, for the receiver and each of its
subclasses.


 

withAllSuperAndSubclassesDoGently:


 

withAllSuperclassesDo:

Evaluate the argument, aBlock, for each of the receiver's superclasses.


  initialize-release top  
 

forgetDoIts

get rid of old DoIt methods


 

nonObsoleteClass

Attempt to find and return the current version of this obsolete class


 

obsolete

Invalidate and recycle local messages,
e.g., zap the method dictionary if can be done safely.


 

superclass:methodDictionary:format:

Basic initialization of the receiver.
Must only be sent to a new instance; else we would need Object flushCache.


  instance creation top  
 

basicNew

Primitive. Answer an instance of the receiver (which is a class) with no
indexable variables. Fail if the class is indexable. Essential. See Object
documentation whatIsAPrimitive.


 

basicNew:

Primitive. Answer an instance of this class with the number
of indexable variables specified by the argument, sizeRequested.
Fail if this class is not indexable or if the argument is not a
positive Integer, or if there is not enough memory available.
Essential. See Object documentation whatIsAPrimitive.


 

initializedInstance

Answer an instance of the receiver which in some sense is initialized. In the case of Morphs, this will yield an instance that can be attached to the Hand after having received the same kind of basic initialization that would be obtained from an instance chosen from the 'new morph' menu. Return nil if the receiver is reluctant for some reason to return such a thing


 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.


 

new:

Answer an instance of this class with the number of indexable
variables specified by the argument, sizeRequested.


  obsolete subclasses top  
 

addObsoleteSubclass:

Weakly remember that aClass was a subclass of the receiver and is now obsolete


 

obsoleteSubclasses

Return all the weakly remembered obsolete subclasses of the receiver


  printing top  
 

defaultNameStemForInstances

Answer a basis for external names for default instances of the receiver. For classees, the class-name itself is a good one.


 

literalScannedAs:notifying:

Postprocesses a literal scanned by Scanner scanToken (esp. xLitQuote).
If scannedLiteral is not an association, answer it.
Else, if it is of the form:
nil->#NameOfMetaclass
answer nil->theMetaclass, if any has that name, else report an error.
Else, if it is of the form:
#NameOfGlobalVariable->anythiEng
answer the global, class, or pool association with that nameE, if any, else
add it to Undeclared a answer the new Association.


 

longPrintOn:

Append to the argument, aStream, the names and values of all of the receiver's instance variables. But, not useful for a class with a method dictionary.


 

printHierarchy

Answer a description containing the names and instance variable names
of all of the subclasses and superclasses of the receiver.


 

printOn:

Refer to the comment in Object|printOn:.


 

printOnStream:

Refer to the comment in Object|printOn:.


 

storeLiteral:on:

Store aCodeLiteral on aStream, changing an Association to ##GlobalName
or ###MetaclassSoleInstanceName format if appropriate


  private top  
 

becomeCompact

Here are the restrictions on compact classes in order for export segments to work: A compact class index may not be reused. If a class was compact in a release of Squeak, no other class may use that index. The class might not be compact later, and there should be nil in its place in the array.


 

becomeCompactSimplyAt:

Make me compact, but don't update the instances. For importing segments.


 

becomeUncompact


 

flushCache

Tell the interpreter to remove the contents of its method lookup cache, if it has
one. Essential. See Object documentation whatIsAPrimitive.


 

indexIfCompact

If these 5 bits are non-zero, then instances of this class
will be compact. It is crucial that there be an entry in
Smalltalk compactClassesArray for any class so optimized.
See the msgs becomeCompact and becomeUncompact.


 

removeSelectorSimply:

Assuming that the argument, selector (a Symbol), is a message selector
in my method dictionary, remove it and its method.


  system startup top  
 

shutDown

This message is sent on system shutdown to registered classes


 

shutDown:

This message is sent on system shutdown to registered classes


 

startUp

This message is sent to registered classes when the system is coming up.


 

startUp:

This message is sent to registered classes when the system is coming up.


 

startUpFrom:

Override this when a per-instance startUp message needs to be sent. For example, to correct the order of 16-bit non-pointer data when it came from a different endian machine.


  testing top  
 

canZapMethodDictionary

Return true if it is safe to zap the method dictionary on #obsolete


 

fullyImplementsVocabulary:

Answer whether instances of the receiver respond to all the messages in aVocabulary


 

implementsVocabulary:

Answer whether instances of the receiver respond to the messages in aVocabulary.


 

instSize

Answer the number of named instance variables
(as opposed to indexed variables) of the receiver.


 

instSpec


 

isBehavior

Return true if the receiver is a behavior


 

isBits

Answer whether the receiver contains just bits (not pointers).


 

isBytes

Answer whether the receiver has 8-bit instance variables.


 

isFixed

Answer whether the receiver does not have a variable (indexable) part.


 

isObsolete

Return true if the receiver is obsolete.


 

isPointers

Answer whether the receiver contains just pointers (not bits).


 

isVariable

Answer whether the receiver has indexable variables.


 

isWeak

Answer whether the receiver has contains weak references.


 

isWords

Answer whether the receiver has 16-bit instance variables.


 

shouldNotBeRedefined

Return true if the receiver should not be redefined.
The assumption is that compact classes,
classes in Smalltalk specialObjects and
Behaviors should not be redefined


  testing class hierarchy top  
 

includesBehavior:


 

inheritsFrom:

Answer whether the argument, aClass, is on the receiver's superclass
chain.


 

kindOfSubclass

Answer a String that is the keyword that describes the receiver's kind
of subclass, either a regular subclass, a variableSubclass, a
variableByteSubclass, a variableWordSubclass, or a weakSubclass.


  testing method dictionary top  
 

allUnsentMessages

Answer an array of all the messages defined by the receiver that are not sent anywhere in the system. 5/8/96 sw


 

canUnderstand:

Answer whether the receiver can respond to the message whose selector
is the argument. The selector can be in the method dictionary of the
receiver's class or any of its superclasses.


 

classThatUnderstands:

Answer the class that can respond to the message whose selector
is the argument. The selector can be in the method dictionary of the
receiver's class or any of its superclasses.


 

hasMethods

Answer whether the receiver has any methods in its method dictionary.


 

includesSelector:

Answer whether the message whose selector is the argument is in the
method dictionary of the receiver's class.


 

scopeHas:ifTrue:

If the argument name is a variable known to the receiver, then evaluate
the second argument, assocBlock.


 

thoroughWhichSelectorsReferTo:special:byte:

Answer a set of selectors whose methods access the argument as a
literal. Dives into the compact literal notation, making it slow but
thorough


 

whichClassIncludesSelector:

Answer the class on the receiver's superclass chain where the argument,
aSymbol (a message selector), will be found. Answer nil if none found.


 

whichSelectorsAccess:

Answer a Set of selectors whose methods access the argument,
instVarName, as a named instance variable.


 

whichSelectorsReferTo:

Answer a Set of selectors whose methods access the argument as a
literal.


 

whichSelectorsReferTo:special:byte:

Answer a set of selectors whose methods access the argument as a literal.


 

whichSelectorsStoreInto:

Answer a Set of selectors whose methods access the argument,
instVarName, as a named instance variable.


  user interface top  
 

allCallsOn:

Answer a SortedCollection of all the methods that call on aSymbol.


 

allLocalCallsOn:

Answer a SortedCollection of all the methods that call on aSymbol, anywhere in my class hierarchy.


 

allUnreferencedInstanceVariables

Return a list of the instance variables known to the receiver which are not referenced in the receiver or any of its subclasses OR superclasses


 

browse


 

browseAllAccessesTo:

Collection browseAllAccessesTo: 'contents'.


 

browseAllCallsOn:

Create and schedule a Message Set browser for all the methods that call
on aSymbol.


 

browseAllStoresInto:

Collection browseAllStoresInto: 'contents'.


 

crossReference

Answer an Array of arrays of size 2 whose first element is a message selector in the receiver's method dictionary and whose second element is a set of all message selectors in the method dictionary whose methods send a message with that selector. Subclasses are not included.


 

unreferencedInstanceVariables

Return a list of the instance variables defined in the receiver which are not referenced in the receiver or any of its subclasses. 2/26/96 sw


 

withAllSubAndSuperclassesDo:


class methods
  class initialization top  
 

flushObsoleteSubclasses

Behavior flushObsoleteSubclasses


 

initialize

Behavior initialize


 

initializeObsoleteSubclasses


  testing top  
 

canZapMethodDictionary

Return false since zapping the method dictionary of Behavior class or its subclasses will cause the system to fail.