Back: Number-truncation and round off Up: Base classes Forward: Object class-initialization   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.120 Object

Defined in namespace Smalltalk
Superclass: none
Category: Language-Implementation
I am the root of the Smalltalk class system. All classes in the system are subclasses of me.

1.120.1 Object class: initialization  (class)
1.120.2 Object: built ins  (instance)
1.120.3 Object: change and update  (instance)
1.120.4 Object: class type methods  (instance)
1.120.5 Object: conversion  (instance)
1.120.6 Object: copying  (instance)
1.120.7 Object: debugging  (instance)
1.120.8 Object: dependents access  (instance)
1.120.9 Object: error raising  (instance)
1.120.10 Object: finalization  (instance)
1.120.11 Object: introspection  (instance)
1.120.12 Object: printing  (instance)
1.120.13 Object: relational operators  (instance)
1.120.14 Object: saving and loading  (instance)
1.120.15 Object: storing  (instance)
1.120.16 Object: syntax shortcuts  (instance)
1.120.17 Object: testing functionality  (instance)
1.120.18 Object: VM callbacks  (instance)


1.120.1 Object class: initialization

dependencies
Answer a dictionary that associates an object with its dependents.

dependencies: anObject
Use anObject as the dictionary that associates an object with its dependents.

finalizableObjects
Answer a set of finalizable objects.

initialize
Initialize the Dependencies dictionary to be a WeakKeyIdentityDictionary.

update: aspect
Do any global tasks for the ObjectMemory events.


1.120.2 Object: built ins

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

== arg
Answer whether the receiver is the same object as arg. This is a very fast test and is called 'object identity'.

allOwners
Return an Array of Objects that point to the receiver.

asOop
Answer the object index associated to the receiver. The object index doesn't change when garbage collection is performed.

at: anIndex
Answer the index-th indexed instance variable of the receiver

at: anIndex put: value
Store value in the index-th indexed instance variable of the receiver

basicAt: anIndex
Answer the index-th indexed instance variable of the receiver. This method must not be overridden, override at: instead

basicAt: anIndex put: value
Store value in the index-th indexed instance variable of the receiver This method must not be overridden, override at:put: instead

basicPrint
Print a basic representation of the receiver

basicSize
Answer the number of indexed instance variable in the receiver

become: otherObject
Change all references to the receiver into references to otherObject. Depending on the implementation, references to otherObject might or might not be transformed into the receiver (respectively, 'two-way become' and 'one-way become'). Implementations doing one-way become answer the receiver (so that it is not lost). Most implementations doing two-way become answer otherObject, but this is not assured - so do answer the receiver for consistency. GNU Smalltalk does two-way become and answers otherObject, but this might change in future versions: programs should not rely on the behavior and results of #become: .

changeClassTo: aBehavior
Mutate the class of the receiver to be aBehavior. Note: Tacitly assumes that the structure is the same for the original and new class!!

checkIndexableBounds: index
Private - Check the reason why an access to the given indexed instance variable failed

checkIndexableBounds: index put: object
Private - Check the reason why a store to the given indexed instance variable failed

class
Answer the class to which the receiver belongs

halt
Called to enter the debugger

hash
Answer an hash value for the receiver. This hash value is ok for objects that do not redefine ==.

identityHash
Answer an hash value for the receiver. This method must not be overridden

instVarAt: index
Answer the index-th instance variable of the receiver. This method must not be overridden.

instVarAt: index put: value
Store value in the index-th instance variable of the receiver. This method must not be overridden.

isReadOnly
Answer whether the object's indexed instance variables can be written

isUntrusted
Answer whether the object is to be considered untrusted.

makeEphemeron
Make the object an 'ephemeron'. An ephemeron is marked after all other objects, and if no references are found to the key except from the object itself, it is sent the #mourn message.

makeFixed
Avoid that the receiver moves in memory across garbage collections.

makeReadOnly: aBoolean
Set whether the object's indexed instance variables can be written

makeUntrusted: aBoolean
Set whether the object is to be considered untrusted.

makeWeak
Make the object a 'weak' one. When an object is only referenced by weak objects, it is collected and the slots in the weak objects are changed to nils by the VM; the weak object is then sent the #mourn message.

mark: aSymbol
Private - use this method to mark code which needs to be reworked, removed, etc. You can then find all senders of #mark: to find all marked methods or you can look for all senders of the symbol that you sent to #mark: to find a category of marked methods.

nextInstance
Private - answer another instance of the receiver's class, or nil if the entire object table has been walked

notYetImplemented
Called when a method defined by a class is not yet implemented, but is going to be

perform: selectorOrMessageOrMethod
Send the unary message named selectorOrMessageOrMethod (if a Symbol) to the receiver, or the message and arguments it identifies (if a Message or DirectedMessage), or finally execute the method within the receiver (if a CompiledMethod). In the last case, the method need not reside on the hierarchy from the receiver's class to Object -- it need not reside at all in a MethodDictionary, in fact -- but doing bad things will compromise stability of the Smalltalk virtual machine (and don't blame anybody but yourself).

This method should not be overridden

perform: selectorOrMethod with: arg1
Send the message named selectorOrMethod (if a Symbol) to the receiver, passing arg1 to it, or execute the method within the receiver (if a CompiledMethod). In the latter case, the method need not reside on the hierarchy from the receiver's class to Object -- it need not reside at all in a MethodDictionary, in fact -- but doing bad things will compromise stability of the Smalltalk virtual machine (and don't blame anybody but yourself).

This method should not be overridden

perform: selectorOrMethod with: arg1 with: arg2
Send the message named selectorOrMethod (if a Symbol) to the receiver, passing arg1 and arg2 to it, or execute the method within the receiver (if a CompiledMethod). In the latter case, the method need not reside on the hierarchy from the receiver's class to Object -- it need not reside at all in a MethodDictionary, in fact -- but doing bad things will compromise stability of the Smalltalk virtual machine (and don't blame anybody but yourself).

This method should not be overridden

perform: selectorOrMethod with: arg1 with: arg2 with: arg3
Send the message named selectorOrMethod (if a Symbol) to the receiver, passing the other arguments to it, or execute the method within the receiver (if a CompiledMethod). In the latter case, the method need not reside on the hierarchy from the receiver's class to Object -- it need not reside at all in a MethodDictionary, in fact -- but doing bad things will compromise stability of the Smalltalk virtual machine (and don't blame anybody but yourself).

This method should not be overridden

perform: selectorOrMethod with: arg1 with: arg2 with: arg3 with: arg4
Send the message named selectorOrMethod (if a Symbol) to the receiver, passing the other arguments to it, or execute the method within the receiver (if a CompiledMethod). In the latter case, the method need not reside on the hierarchy from the receiver's class to Object -- it need not reside at all in a MethodDictionary, in fact -- but doing bad things will compromise stability of the Smalltalk virtual machine (and don't blame anybody but yourself).

This method should not be overridden

perform: selectorOrMethod withArguments: argumentsArray
Send the message named selectorOrMethod (if a Symbol) to the receiver, passing the elements of argumentsArray as parameters, or execute the method within the receiver (if a CompiledMethod). In the latter case, the method need not reside on the hierarchy from the receiver's class to Object -- it need not reside at all in a MethodDictionary, in fact -- but doing bad things will compromise stability of the Smalltalk virtual machine (and don't blame anybody but yourself).

This method should not be overridden

primitiveFailed
Called when a VM primitive fails

shallowCopy
Returns a shallow copy of the receiver (the instance variables are not copied)

shouldNotImplement
Called when objects belonging to a class should not answer a selector defined by a superclass

size
Answer the number of indexed instance variable in the receiver

subclassResponsibility
Called when a method defined by a class should be overridden in a subclass

tenure
Move the object to oldspace.


1.120.3 Object: change and update

broadcast: aSymbol
Send the unary message aSymbol to each of the receiver's dependents

broadcast: aSymbol with: anObject
Send the message aSymbol to each of the receiver's dependents, passing anObject

broadcast: aSymbol with: arg1 with: arg2
Send the message aSymbol to each of the receiver's dependents, passing arg1 and arg2 as parameters

broadcast: aSymbol withArguments: anArray
Send the message aSymbol to each of the receiver's dependents, passing the parameters in anArray

broadcast: aSymbol withBlock: aBlock
Send the message aSymbol to each of the receiver's dependents, passing the result of evaluating aBlock with each dependent as the parameter

changed
Send update: for each of the receiver's dependents, passing them the receiver

changed: aParameter
Send update: for each of the receiver's dependents, passing them aParameter

update: aParameter
Default behavior is to do nothing. Called by #changed and #changed:


1.120.4 Object: class type methods

species
This method has no unique definition. Generally speaking, methods which always return the same type usually don't use #class, but #species. For example, a PositionableStream's species is the class of the collection on which it is streaming (used by upTo:, upToAll:, upToEnd). Stream uses species for obtaining the class of next:'s return value, Collection uses it in its #copyEmpty: message, which in turn is used by all collection-re- turning methods. An Interval's species is Array (used by collect:, select:, reject:, etc.).

yourself
Answer the receiver


1.120.5 Object: conversion

asValue
Answer a ValueHolder whose initial value is the receiver.


1.120.6 Object: copying

copy
Returns a shallow copy of the receiver (the instance variables are not copied). The shallow copy receives the message postCopy and the result of postCopy is passed back.

deepCopy
Returns a deep copy of the receiver (the instance variables are copies of the receiver's instance variables)

postCopy
Performs any changes required to do on a copied object. This is the place where one could, for example, put code to replace objects with copies of the objects


1.120.7 Object: debugging

examine
Print all the instance variables of the receiver on the Transcript

examineOn: aStream
Print all the instance variables of the receiver on aStream

inspect
In a GUI environment, this opens a tool to examine and modify the receiver. In the default image, it just calls #examine.

validSize
Answer how many elements in the receiver should be inspected


1.120.8 Object: dependents access

addDependent: anObject
Add anObject to the set of the receiver's dependents. Important: if an object has dependents, it won't be garbage collected.

dependents
Answer a collection of the receiver's dependents.

release
Remove all of the receiver's dependents from the set and allow the receiver to be garbage collected.

removeDependent: anObject
Remove anObject to the set of the receiver's dependents. No problem if anObject is not in the set of the receiver's dependents.


1.120.9 Object: error raising

doesNotUnderstand: aMessage
Called by the system when a selector was not found. message is a Message containing information on the receiver

error: message
Display a walkback for the receiver, with the given error message. Signal an `Error' exception (you can trap it the old way too, with `ExError'

halt: message
Display a walkback for the receiver, with the given error message. Signal an `Halt' exception (you can trap it the old way too, with `ExHalt')


1.120.10 Object: finalization

addToBeFinalized
Arrange things so that #finalize is sent to the object when the garbage collector finds out there are only weak references to it.

finalize
Do nothing by default

mourn
This method is sent by the VM to weak and ephemeron objects when one of their fields is found out to be garbage collectable (this means, for weak objects, that there are no references to it from non-weak objects, and for ephemeron objects, that the only paths to the first instance variable pass through other instance variables of the same ephemeron). The default behavior is to do nothing.

removeToBeFinalized
Unregister the object, so that #finalize is no longer sent to the object when the garbage collector finds out there are only weak references to it.


1.120.11 Object: introspection

instVarNamed: aString
Answer the instance variable named aString in the receiver.

instVarNamed: aString put: anObject
Answer the instance variable named aString in the receiver.


1.120.12 Object: printing

basicPrintNl
Print a basic representation of the receiver, followed by a new line.

basicPrintOn: aStream
Print a represention of the receiver on aStream

representation

display
Print a represention of the receiver on the Transcript (stdout the GUI is not active). For most objects this is simply its #print representation, but for strings and characters, superfluous dollars or extra pair of quotes are stripped.

displayNl
Print a represention of the receiver, then put a new line on the Transcript (stdout the GUI is not active). For most objects this is simply its #printNl representation, but for strings and characters, superfluous dollars or extra pair of quotes are stripped.

displayOn: aStream
Print a represention of the receiver on aStream. For most objects this is simply its #printOn: representation, but for strings and characters, superfluous dollars or extra pair of quotes are stripped.

displayString
Answer a String representing the receiver. For most objects this is simply its #printString, but for strings and characters, superfluous dollars or extra pair of quotes are stripped.

print
Print a represention of the receiver on the Transcript (stdout the GUI is not active)

printNl
Print a represention of the receiver on stdout, put a new line the Transcript (stdout the GUI is not active)

printOn: aStream
Print a represention of the receiver on aStream

printString
Answer a String representing the receiver


1.120.13 Object: relational operators

~= anObject
Answer whether the receiver and anObject are not equal

~~ anObject
Answer whether the receiver and anObject are not the same object


1.120.14 Object: saving and loading

binaryRepresentationObject
This method must be implemented if PluggableProxies are used with the receiver's class. The default implementation raises an exception.

postLoad
Called after loading an object; must restore it to the state before `preStore' was called. Do nothing by default

postStore
Called after an object is dumped; must restore it to the state before `preStore' was called. Call #postLoad by default

preStore
Called before dumping an object; it must *change* it (it must not answer a new object) if necessary. Do nothing by default

reconstructOriginalObject
Used if an instance of the receiver's class is returned as the #binaryRepresentationObject of another object. The default implementation raises an exception.


1.120.15 Object: storing

store
Put a String of Smalltalk code compiling to the receiver on the Transcript (stdout the GUI is not active)

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

storeNl
Put a String of Smalltalk code compiling to the receiver, followed by a new line, on the Transcript (stdout the GUI is not active)

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

storeString
Answer a String of Smalltalk code compiling to the receiver


1.120.16 Object: syntax shortcuts

-> anObject
Creates a new instance of Association with the receiver being the key and the argument becoming the value


1.120.17 Object: testing functionality

ifNil: nilBlock
Evaluate nilBlock if the receiver is nil, else answer self

ifNil: nilBlock ifNotNil: notNilBlock
Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver.

ifNotNil: notNilBlock
Evaluate notNiilBlock if the receiver is not nil, passing the receiver. Else answer nil.

ifNotNil: notNilBlock ifNil: nilBlock
Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver.

isArray
Answer `false'.

isBehavior
Answer `false'.

isCObject
Answer `false'.

isCharacter
Answer `false'.

isCharacterArray
Answer `false'.

isClass
Answer `false'.

isFloat
Answer `false'.

isInteger
Answer `false'.

isKindOf: aClass
Answer whether the receiver's class is aClass or a subclass of aClass

isMemberOf: aClass
Returns true if the receiver is an instance of the class 'aClass'

isMeta
Same as isMetaclass

isMetaClass
Same as isMetaclass

isMetaclass
Answer `false'.

isNamespace
Answer `false'.

isNil
Answer whether the receiver is nil

isNumber
Answer `false'.

isSmallInteger
Answer `false'.

isString
Answer `false'.

isSymbol
Answer `false'.

notNil
Answer whether the receiver is not nil

respondsTo: aSymbol
Returns true if the receiver understands the given selector


1.120.18 Object: VM callbacks

badReturnError
Called back when a block performs a bad return.

mustBeBoolean
Called by the system when ifTrue:*, ifFalse:*, and: or or: are sent to anything but a boolean

noRunnableProcess
Called back when all processes are suspended

userInterrupt
Called back when the user presses Ctrl-Break



Back: Object-testing functionality Up: Object Forward: ObjectDumper   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on July, 23 2009 using texi2html