Re: Unnecessary Boolean Warning
Re: Unnecessary Boolean Warning
- Subject: Re: Unnecessary Boolean Warning
- From: Preston Sumner <email@hidden>
- Date: Wed, 03 Aug 2011 21:17:53 -0600
On Aug 3, 2011, at 8:10 PM, Andy Lee wrote:
> On Aug 3, 2011, at 9:51 PM, Graham Cox wrote:
>> I think the point they wanted to get across was that they didn't want to see code like this:
>>
>> if( someFunction() && someOtherFunction()){ ... }
>>
>> instead of:
>>
>> if( someFunction())
>> {
>> if( someOtherFunction())
>> {
>> ....
>> }
>> }
>
>
> This I agree with. I "know"[1] about the short-circuiting behavior of && and still I'd prefer the conditional flow be super-clear rather than have to think about operator rules even a tiny bit. But now we're back where we started.
I find short-circuit evaluation easier to read and much more concise, and, of course, it's always nice to avoid unnecessary levels of nesting.
Preston_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden