• 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: argument checks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: argument checks


  • Subject: Re: argument checks
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 12 Jun 2008 16:00:45 -0500

On Jun 12, 2008, at 2:29 AM, Graham Cox wrote:

On 12 Jun 2008, at 5:03 pm, Chris Suter wrote:

In the original example, myNum was being passed as a argument rather than having a message to sent to it and it’s often not safe to pass nil objects as arguments.

Hmmm... well, what's the function it's passed to going to do with it, other than call a method on it? If it's doing anything else, it's breaking other (much stronger) rules. If it tries to access its ivars directly, that's breaking encapsulation.

Not if you're passing an object to a method of its own class. Then, it's permitted to access its own implementation details. So, for example, -[NSDictionary initWithDictionary:] may very well operate by accessing the internal details of the passed-in dictionary.


Regards,
Ken

_______________________________________________

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: 
 >argument checks (From: Ashley Perrien <email@hidden>)
 >Re: argument checks (From: Graham Cox <email@hidden>)
 >Re: argument checks (From: Chris Suter <email@hidden>)
 >Re: argument checks (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Troubles with CollectionView and IKImageBrowserView
  • Next by Date: Re: removeFrameUsingName: doesn't?
  • Previous by thread: Re: argument checks
  • Next by thread: Re: argument checks
  • Index(es):
    • Date
    • Thread