Re: NSString and NSCopying Protocol
Re: NSString and NSCopying Protocol
- Subject: Re: NSString and NSCopying Protocol
- From: Glenn Howes <email@hidden>
- Date: Wed, 20 Nov 2002 00:28:15 -0600
Isn't that one of the advantages of immutable objects? Nothing you do
to string 1 will cause string 2 to change; this seems as good a
definition of functional independence as anything.
Are you seeing a problem where this logical independence is failing?
On Tuesday, November 19, 2002, at 09:13 AM, Starman wrote:
Hi everyone !
I just saw that NSString doesn't conform to NSCopying Protocol.
Theorically, the documentation of the protocol says : "The exact
meaning of \"copy\" can vary from class to class, but a copy must be a
functionally independent object with values identical to the original
at the time the copy was made."
So, I understand that a copy of a NSString gives me a new instance of
the object. But in fact, I get the same object (same memory address),
with retainCount incremented by one.
you can find a small tool to check what I say at the following url :
http://ixqdev.online.fr/BetaPBX/testString.tgz
I think it could be something optimized, since you gain memory space
and computing time, but can we say that NSString conforms to NSCopying
Protocol ? It has not the behaviour a developer will expect....
Am I correct ?
Starman
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.