• 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: NSArray behavior changes ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray behavior changes ?


  • Subject: Re: NSArray behavior changes ?
  • From: Stefan Jung <email@hidden>
  • Date: Fri, 21 Sep 2001 17:50:50 +0200

I found that on of my programs couldn't load files it created under
10.0.4 if run from 10.1.
The data were written("NSCoded") with no NSArray, but only
NSMutableArrays.
Nonetheless PB logs:
Exception raised during posting of notification. Ignored.
exception: *** -[NSCFArray sortUsingFunction:context:]: mutating method
sent to immutable object

So there is a bigger change. Under 10.0.4 NSMutableArrays are obviously
saved as NSArrays.

Stefan Jung

On Freitag, September 21, 2001, at 11:20 Uhr, Ondra Cada wrote:
> Raphael,
>
>>>>>>> Raphael Sebbe (RS) wrote at Fri, 21 Sep 2001 11:05:05 +0200:
> RS> I have a NSMutableArray that I want to copy (immutable). Basically :
> RS>
> RS> NSArray *array;
> RS> array = [marray copy];
> RS>
> RS> The objects in marray implement NSCopying but are *not* copied, but
> RS> retained instead. This seems to have changed since the released
> builds
> RS> of OS X, when objects in the array were copied. Could someone
> confirm it
> RS> has ? Perhaps I am totally wrong, but that code has worked for a
> long
> RS> time and suddenly broke...
>
> Quite the contrary. The code was broken in OSX (making those unnecessary
> copies), and now was corrected (to work as designed almost ten years
> ago).
>
> Instances of immutable classes generally should not make copies on
> -copy,
> but just return themselves retained. That can be a *VERY* considerable
> optimalization, both memory- and speed-wise. Since the instance is
> immutable,
> there's no disadvantage.
> ---
> Ondra Cada
> OCSoftware: email@hidden http://www.ocs.cz
> private email@hidden http://www.ocs.cz/oc
> _______________________________________________
> cocoa-dev mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >Re: NSArray behavior changes ? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: bug in NSBundle when using QuickTime ?
  • Next by Date: Advice request from newbie
  • Previous by thread: Re: NSArray behavior changes ?
  • Next by thread: Re: NSArray behavior changes?
  • Index(es):
    • Date
    • Thread