FROM : Glenn Howes
DATE : Wed Nov 20 07:28:15 2002
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_removed>
> 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Wed Nov 20 07:28:15 2002
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_removed>
> 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Starman | Nov 19, 16:13 | |
| Ondra Cada | Nov 20, 05:19 | |
| Sherm Pendley | Nov 20, 05:49 | |
| Glenn Howes | Nov 20, 07:28 | |
| Jonathan E. Jackel | Nov 20, 23:28 | |
| Finlay Dobbie | Nov 23, 23:43 |






Cocoa mail archive

