|
|
Class: ProtoObject
nil
|
+--ProtoObject
This class inherits NOTHING - most messages will lead into doesNotUnderstand:
|
+--Future
|
+--Lazy
|
+--LazyValue
- Package:
- stx:libbasic
- Category:
- Kernel-Objects
- Version:
- rev:
1.13
date: 2009/12/01 19:59:38
- user: cg
- file: ProtoObject.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger (not much authoring, though)
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.
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.
queries
-
class
-
return the receivers class
-
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: aBlock
-
-
ifNotNil: aBlockOrValue
-
-
isBehavior
-
return true, if the receiver is describing another objects behavior.
False is returned here - the method is only redefined in Behavior.
-
isBlock
-
-
isException
-
-
isExceptionHandler
-
-
isJavaObject
-
-
isLazyValue
-
-
isLiteral
-
|