"nil did not understand #selector" is great.
Similarly, "Instance of " can be replace by "a" as in
"aObject did not understand #selector"
"aReadWriteStream did not understand #selector"
For classes
"PragmaMenuBuilder class did not understand #selector"
Daniel Slomovits wrote:
I think it's because nil *is* pretty special--this is the equivalent
of a NullPointerException or similar in other languages (even though
in fact nil is an object like any other, it *is* usually a different
type of *semantic* error on the part of the programmer than with any
other class). UndefinedObject is also a pretty long class name, so
it's nice to leave that out. But I would be all in favor of making it
"nil did not understand #selector", to be more consistent but still
concise.
On Fri, Jun 27, 2025, 3:00 PM Aik-Siong Koh <as...@askoh.com
<mailto:as...@askoh.com>> wrote:
Why is UndefinedObject version of "did not understand" so
different from
others?
It also inverts the object message paradigm.
Thanks
Aik-Siong Koh
description
"Returns a textual description of the exception (based on the
message instance variable). If message is nil, it returns the
defaultDescription instead."
message ifNil: [ ^ self defaultDescription ].
message lookupClass == UndefinedObject ifTrue: [
^ message selector printString , ' was sent to nil' ].
^ 'Instance of ' , message lookupClass printString
, ' did not understand ' , message selector printString