• 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: What is the expected Cocoa API behavior in an incomplete object traversal?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the expected Cocoa API behavior in an incomplete object traversal?


  • Subject: Re: What is the expected Cocoa API behavior in an incomplete object traversal?
  • From: Tito Ciuro <email@hidden>
  • Date: Fri, 15 Oct 2010 20:55:49 -0300

Hi Martin,

On 15/10/2010, at 20:48, Martin Wierschin wrote:

>> Well, in a normal situation the array would contain conforming objects. However, as it can happen once in a while, one can add an object to an array thinking it's of one type when in fact it's another.
>
> When you say "one can add", do you mean that the user chooses these objects in the GUI somehow? If so, I might recommend you disallow the user from making such an errant choice in the first place. Think of the Open panel: the application controls which files are selectable. Or maybe if the user chooses objects of the wrong class, the operation should be disabled in the GUI. Or do preflight checks that present an explanation sheet allowing the user to cancel or just skip the non-conforming objects. Your description so far is too vague to know what's best, but presenting an NSError after the operation completes doesn't sound like the best solution.
>
> If you really mean that occasionally your code adds an object to an array thinking it's another class, that sounds like a bug to me and I'd throw an exception so you can fix it ASAP. Though in a non-debug build I might choose to gracefully just skip the object and avoid the exception, as you're doing now.
>
> ~Martin

No, the method is part of an API meant for developers. So even though in most cases there won't be an issue, occasionally there could be some anomaly, in which non-conforming objects could slip through. How to let the developer know that this issue happened is what I'm interested in.

Thanks for the help,

-- Tito
_______________________________________________

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

  • Follow-Ups:
    • Re: What is the expected Cocoa API behavior in an incomplete object traversal?
      • From: Uli Kusterer <email@hidden>
References: 
 >What is the expected Cocoa API behavior in an incomplete object traversal? (From: Tito Ciuro <email@hidden>)
 >Re: What is the expected Cocoa API behavior in an incomplete object traversal? (From: Corbin Dunn <email@hidden>)
 >Re: What is the expected Cocoa API behavior in an incomplete object traversal? (From: Tito Ciuro <email@hidden>)
 >Re: What is the expected Cocoa API behavior in an incomplete object traversal? (From: Martin Wierschin <email@hidden>)

  • Prev by Date: Re: What is the expected Cocoa API behavior in an incomplete object traversal?
  • Next by Date: Re: NSScanner Failing with EXC_BAD_ACCESS
  • Previous by thread: Re: What is the expected Cocoa API behavior in an incomplete object traversal?
  • Next by thread: Re: What is the expected Cocoa API behavior in an incomplete object traversal?
  • Index(es):
    • Date
    • Thread