|
|
|
|
|
by alayne
4913 days ago
|
|
He's not being sarcastic. Maybe a better example of what he is trying to get at is if (![missleLauncher isDisabled]) { /* declare thermonuclear war */ } When missleLauncher is nil, thermonuclear war is still declared which may not be the programmer's intent. |
|
In Objective-C, the question "should I name my method isEnabled or isDisabled?" has a reasonable answer - you consider what makes most sense (or any sense) when called on Nil.
This is probably a good rule for other languages too - "negative" booleans can lead to double-negatives and unreadable code.