On Apr 24, 2014, at 14:21 , Andy Lee <ag...@mac.com> wrote:

> I still don't see how
> 
> foo = [@"Something" fallbackIfNil:foo];
> 
> has any advantage over
> 
> foo = foo ?: @"Something";

I don’t see how the latter has any advantage over your earlier suggestion [more 
or less]:

        if (!foo)
                foo = @“Something”;

Admittedly, it takes two lines instead of one. OTOH, as I said in another 
recent thread, it seems to me that for a *reader* of the code, the latter form 
is far more accessible than code with the “?…:” operator, which tends to force 
the reader to figure out if the code is correct or not. I note that in this 
thread, like the other one, most of the discussion has basically been about 
figuring out what’s actually correct. Is there *any* confusion over the “if” 
version?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to