3 ms·
I'm reminded of the fact that in Smalltalk, nil accepts any message, does nothing, and returns nil. The same is true of Objective-C's object semantics, which m
by bitwize 5y ago
I'm reminded of the fact that in Smalltalk, nil accepts any message, does nothing, and returns nil.
The same is true of Objective-C's object semantics, which means that language has two flavors of null pointer, one of which will scream SIGSEGV if you do anything significant with it, the other having more subtle failure modes...
- fmakunbound 5y agoYou actually get message not understood and dropped into the Smalltalk debugger if you send a message to nil.
- massung 5y agoJust to be clear for @bitwize, nil is an object like everything else in smalltalk. It's an instance of UndefinedObject. It isn't special in any way and executes any method it understands just like all other objects. Object>>isNil ^false UndefinedObject>>isNil ^true It drops into the debugger if you pass it a message it doesn't understand.
- bitwize 5y agoI think I might've described how Objective-C works. It's been a while since I worked in depth with Smalltalk.