3 ms·
Surprised no one has mentioned objective-c's sending message to nil which is relied on throughout apple frameworks which is basically what the article says is a
by SigmundA 13y ago
Surprised no one has mentioned objective-c's sending message to nil which is relied on throughout apple frameworks which is basically what the article says is a lot of work to implement but given to you for free in obj-c: http://stackoverflow.com/questions/156395/sending-a-message-to-nil http://stackoverflow.com/questions/156395/sending-a-message-...
C# kinda does this for nullable types, it is referred to as null lifting.
- mikeash 13y agoSadly, it's not too consistent there. For example, this is OK: [[obj find] doThing] But this will crash on nil: [array addObject: [obj find]] Nop-on-nil can be convenient, but without APIs that also nop on nil parameters, it can be a little annoying when you still have to check half the time.