• 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: Determining if NSArray/NSDictionary is immutable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining if NSArray/NSDictionary is immutable


  • Subject: Re: Determining if NSArray/NSDictionary is immutable
  • From: email@hidden
  • Date: Sun, 10 Jul 2005 12:18:35 +1000

> Given that you are writing a test harness, can you safely attempt to modify the returned collection and catch the exception if it is immutable?
>
> I.e.
>
> @try {
>     [returnArray addObject; 0];
> } @catch {id e} {
>     /// nope, not mutable
>     return;
> }
>
> // hey, we mutated... boo.

Well, yes, that's what I've done for the moment, as I said in my original post.  It works well enough, except it requires enabling ObjC exceptions.  No real biggy, but I do a lot of framework and library development, and hate solutions which complicate the build process, since that makes using my stuff harder for others.

Wade Tregaskis (AIM, Yahoo & Skype: wadetregaskis, AIM audio/video chat: email@hidden, ICQ: 40056898, MSN: email@hidden, Jabber: email@hidden)
-- Sed quis custodiet ipsos custodes?
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Determining if NSArray/NSDictionary is immutable
      • From: p3consulting <email@hidden>
  • Prev by Date: Re: Documentation frustrations
  • Next by Date: Concerning Custom Sheets and NIB files...
  • Previous by thread: Re: Determining if NSArray/NSDictionary is immutable
  • Next by thread: Re: Determining if NSArray/NSDictionary is immutable
  • Index(es):
    • Date
    • Thread