|
Class: ProtoObject
nil
|
+--ProtoObject
This class inherits NOTHING - most messages will lead into doesNotUnderstand:
|
+--DelayedValue
|
+--Lazy
|
+--LazyValue
- Package:
- stx:libbasic
- Category:
- Kernel-Objects
- Version:
- rev:
1.46
date: 2023/12/14 08:25:12
- user: cg
- file: ProtoObject.st directory: libbasic
- module: stx stc-classLibrary: libbasic
a minimum object without much protocol;
Provides the minimum required to prevent inspectors from crashing,
and debuggers from blocking.
(i.e. instead of inheriting from nil, better inherit from this).
Named after a similar class found in Dolphin-Smalltalk.
copyrightCOPYRIGHT (c) 2004 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
helpers
-
shallowCopyOf: anObject
-
return a copy of anObject with shared subobjects (a shallow copy)
i.e. the copy shares referenced instvars with its original.
error handling
-
doesNotUnderstand: aMessage
-
this message is sent by the runtime system (VM) when
a message is not understood by some object (i.e. there
is no method for that selector). The original message has
been packed into aMessage (i.e. the receiver, selector and
any arguments) and the original receiver is then sent the
#doesNotUnderstand: message.
Here, we raise another signal which usually enters the debugger.
You can of course redefine #doesNotUnderstand: in your classes
to implement message delegation,
or handle the MessageNotUnderstood exception gracefully.
inspecting
-
basicInspect
-
this method is required to allow inspection of the object
-
inspect
-
launch an inspector on the receiver.
this method (or better: inspectorClass) can be redefined in subclasses
to start special inspectors.
Usage example(s):
launch an inspector on the receiver.
this method (or better: inspectorClass) can be redefined in subclasses
to start special inspectors.
|
Usage example(s):
-
inspectorClass
-
return the class of an appropriate inspector
-
inspectorLabelInWindowTitle
( an extension from the stx:libtool package )
-
what is the inspector showing for me in the title.
Moved out of he inspector to allow redefinition for eg. remote objects
-
inspectorValueListIconFor: anInspector
( an extension from the stx:libtool package )
-
returns the icon to be shown alongside the value list of an inspector
-
instVarAt: index
-
this method is required to allow inspection of the object
-
isKindOf: aBehavior
-
this method is required Behavior>>#allSubInstancesDo:
-
perform: aSelector
-
this method is required to allow inspection of the object
-
perform: aSelector ifNotUnderstood: exceptionBlock
-
try to send message aSelector to the receiver.
If it's understood, return the method's returned value,
otherwise return the value of the exceptionBlock.
Read this:
Many programmers do an Error-handle to perform a similar
checked-message send. However, this method is more specific,
in that only errors for the given selector and this receiver are caught - not any other
doesNotUnderstand, and especially not any other error.
-
perform: aSelector with: arg1
-
this method is required to allow inspection of the object
-
perform: aSelector with: arg1 with: arg2
-
this method is required to allow inspection of the object
-
perform: aSelector with: arg1 with: arg2 with: arg3
-
this method is required to allow inspection of the object
-
perform: aSelector with: arg1 with: arg2 with: arg3 with: arg4
-
this method is required to allow inspection of the object
-
perform: aSelector with: arg1 with: arg2 with: arg3 with: arg4 with: arg5
-
this method is required to allow inspection of the object
-
perform: aSelector with: arg1 with: arg2 with: arg3 with: arg4 with: arg5 with: arg6
-
this method is required to allow inspection of the object
-
perform: aSelector withArguments: argArray
-
send the message aSelector with all args taken from argArray
to the receiver.
1-to-1 Copy from the same method in Object!
-
referencesAny: anObject
-
this method is required to allow inspection of the object
-
referencesInstanceOf: anObject
-
this method is required to allow inspection of the object
-
referencesObject: anObject
-
this method is required to allow inspection of the object
queries
-
basicSize
-
this method is required to allow restore of the object
-
class
-
return the receiver's class
-
className
-
this method is required to allow inspection of the object
-
classNameWithArticle
-
this method is required to allow inspection of the object
-
identityHash
-
return an Integer useful as a hash key for the receiver.
This hash should return same values for the same object (i.e. use
this to hash on identity of objects).
We cannot use the Objects address (as other smalltalks do) since
no object-table exists and the hashval must not change when objects
are moved by the collector. Therefore we assign each object a unique
Id in the object header itself as its hashed upon.
(luckily we have 11 bits spare to do this - unluckily its only 11 bits).
Time will show, if 11 bits are enough; if not, another entry in the
object header will be needed, adding 4 bytes to every object. Alternatively,
hashed-upon objects could add an instvar containing the hash value.
testing
-
ifNil: aBlockOrValue
-
return myself, or the result from evaluating the argument, if I am nil.
This is much like #?, but sends #value to the argument in case of a nil
receiver.
Notice:
This method is open coded (inlined) by the compiler(s)
- redefining it may not work as expected.
-
ifNil: nilBlockOrValue ifNotNil: notNilBlockOrValue
-
return the value of the first arg, if I am nil,
the result from evaluating the 2nd argument, if I am not nil.
Notice:
This method is open coded (inlined) by the compiler(s)
- redefining it may not work as expected.
-
ifNotNil: aBlockOrValue
-
return myself if nil, or the result from evaluating the argument,
if I am not nil.
Notice:
This method is open coded (inlined) by the compiler(s)
- redefining it may not work as expected.
-
ifNotNil: notNilBlockOrValue ifNil: nilBlockOrValue
-
return the value of the 2nd arg, if I am nil,
the result from evaluating the 1st argument, if I am not nil.
Notice:
This method is open coded (inlined) by the compiler(s)
- redefining it may not work as expected.
-
isBehavior
-
return true, if the receiver is describing another object's behavior.
False is returned here - the method is only redefined in Behavior.
-
isBlock
-
-
isBridgeProxy
-
answer true, if I am a proxy object for a bridged remote object
-
isException
-
-
isExceptionHandler
-
-
isJavaObject
-
return true if this is a JavaObject.
false is returned here - the method is only redefined in JavaObject.
-
isLazyValue
-
-
isLiteral
-
-
isNil
-
-
isProtoObject
-
-
isProxy
-
answer true, if I am a proxy for another (lazy loaded) object
visiting
-
acceptVisitor: aVisitor with: aParameter
-
double-dispatch via visitObject:with: into a Visitor.
Subclasses redefine this to pass their type in the message name (i.e. visitXXX:)
|