patching base classes

Ian Piumarta Ian.Piumarta at inria.fr
Wed Nov 17 19:03:29 UTC 1999


> Populating Object with "is...." messages seems... just... wrong and
> unscalable.


Object>>doesNotUnderstand: aMessage 
	 "Handle the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message (typically sent from the machine when a message is sent to the receiver and no method is defined for that selector)."
	"Testing: (3 activeProcess)"

	(Preferences autoAccessors and: [self tryToDefineVariableAccess: aMessage])
		ifTrue: [^ aMessage sentTo: self].
	(Preferences autoDeclineMembership
		and: [(aMessage selector beginsWith: 'is')
		and: [Symbol
				hasInterned: (aMessage selector copyFrom: 3 to: aMessage selector size)
				ifTrue: [:sym | (Smalltalk includesKey: sym) ifTrue: [^false]]]])
		ifTrue: [^ false].
	MessageNotUnderstood new message: aMessage;
		signal.
	^aMessage sentTo: self



"42 isFrob"
"42 isInterpreter"
"Preferences enable: autoDeclineMembership"
"42 isFrob"
"42 isInterpreter"


Happy scaling!

Ian

PS: And thus the obvious logical loophole is opened up for all to
    marvel at:

	Interpreter new isInterpreter
		=> false

    ;-)





More information about the Squeak-dev mailing list