• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Good idea/bad idea?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Good idea/bad idea?


  • Subject: Re: Good idea/bad idea?
  • From: glenn andreas <email@hidden>
  • Date: Thu, 24 Apr 2014 16:14:10 -0500

That won't do any good, since if the receiver is nil, it'll return nil (since nil isn't an object like it is in Smalltalk)

So the only place where it actually gets called will be the places that don't need it.


On Apr 24, 2014, at 3:10 PM, Alex Zavatone <email@hidden> wrote:

> Could we throw a category on NSObject for that and then every class that originates with NSObject gets that lovely method?
>
> Agree on the clunky bit, but so is using the @ compiler directive to accomplish everything that couldn't be fit in in the first place.  Not as if I know a better way to do it, but I agree, they do feel clunky.
>
> On Apr 24, 2014, at 3:48 PM, Lee Ann Rucker wrote:
>
>> In Smalltalk, where nil is an object like everything else, and we were working with calls out to C APIs that had a lot of required parameters, we added an "orIfNil:" that was very useful:
>>
>> foo := bar orIfNil:10.
>>
>> Nil
>> orIfNil:other
>> ^other
>>
>> Object
>> orIfNil:other
>> ^self
>>
>> It would be useful in ObjC if there were an elegant way to do it. Macros are just clunky.
>
> _______________________________________________
>
> 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

_______________________________________________

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


References: 
 >Good idea/bad idea? (From: Alex Zavatone <email@hidden>)
 >Re: Good idea/bad idea? (From: Luther Baker <email@hidden>)
 >Re: Good idea/bad idea? (From: Lee Ann Rucker <email@hidden>)
 >Re: Good idea/bad idea? (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Framework for ambient light level?
  • Next by Date: Re: Good idea/bad idea?
  • Previous by thread: Re: Good idea/bad idea?
  • Next by thread: Re: Good idea/bad idea?
  • Index(es):
    • Date
    • Thread