" Smalltalk/Object.st -- behaviour commmon to all objects -*- Smalltalk -*- " Object () Object new [ ^self _clone initialise ] Object initialise [ ^self ] Object yourself [ ^self ] Object species [ ^self ] Object isNil [ ^false ] Object notNil [ ^true ] Object _identityHash { return (oop)((unsigned)self >> 4); } Object identityHash [ ^SmallInteger _value: self _identityHash ] Object hash [ ^self identityHash ] Object == anObject { return self == v_anObject ? v_true : v_false; } Object ~~ anObject [ ^(self == anObject) not ] Object = anObject [ ^self == anObject ] Object ~= anObject [ ^(self = anObject) not ] Object not [ ^nil ] Object ifTrue: aBlock [ ^aBlock value ] Object and: aBlock [ ^aBlock value ] Object ifFalse: aBlock [ ^nil ] Object or: aBlock [ ^self ] "xxx - ifTrue/False: should be defined the same as and:/or:" Object assert [] Object refute [ self error: 'refutation failed' ] Object assert: aBlock [ {#ifndef NDEBUG //}. aBlock value assert. {#endif //}. ] Object refute: aBlock [ {#ifndef NDEBUG //}. aBlock value refute. {#endif //}. ] Object isKindOf: parentObject [ | vtbl parentVtbl | vtbl := self _vtbl. vtbl := parentObject _vtbl. [vtbl notNil] whileTrue: [ vtbl == parentVtbl ifTrue: [^true]. vtbl := vtbl delegate ]. ^false ] Object isMemberOf: siblingObject [ ^self _vtbl == siblingObject _vtbl ] Object printString [ ^(String new: 32) writeStream print: self; contents ] Object printOn: aStream [ aStream nextPutAll: self debugName ] Object _error: _reasonString { fprintf(stderr, "%s\n", (char *)v__reasonString); exit(1); } Object error: reasonString [ ^self _error: reasonString _cString ] Object subclassResponsibility [ ^self error: self debugName , ' should have overridden a message' ] Object subclassResponsibility: selector [ ^self error: self debugName , ' should have overridden ' , selector ] Object shouldNotImplement [ ^self error: 'this message is inappropriate for this object' ] Object primitiveFailed [ ^self error: 'a primitive has failed' ]