Re: Read-only properties

2008-10-12 Thread DKJ
On 12 Oct, 2008, at 08:56, Roland King wrote: If however you don't want the caller to modify the properties of the objects *in* the array, then unless those objects are immutable, returning a copy of the array won't help you anyway. Remember an array of objects is just an array of pointers t

Re: Read-only properties

2008-10-12 Thread Roland King
well first off you're returning an NSArray which is immutable, so nobody can change the actual array itself, ie add or delete members (unless of course you really actually return a mutable one and the caller ignores the warnings and mutates it). If however you don't want the caller to modif

Re: Read-only properties

2008-10-12 Thread Steven Degutis
I may be mistaken on this, but it sounds like there isn't a way to do what you're trying to without making each array item immutable (such as NSString instead of NSMutableString). The reason for this lies behind how pointers work: once you have a reference, you can alter whatever is inside that ref

Re: Read-only properties

2008-10-12 Thread DKJ
oops... of course that should have been: @property(readonly) NSArray *myArray; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-ad

Read-only properties

2008-10-12 Thread DKJ
I'd like to have something like this in my class: @property(readonly) *NSArray myArray; But I don't want any of the individual objects in the array to be modified, so I'd like to return a copy of the array. Is there a way of getting @synthesise to ensure this? Or do I need to write m