Re: Cocoa Documentation on NSFormatter
Re: Cocoa Documentation on NSFormatter
- Subject: Re: Cocoa Documentation on NSFormatter
- From: Ondra Cada <email@hidden>
- Date: Sat, 15 Dec 2001 15:43:27 +0100
Thomas,
perhaps I just don't understand properly, but...
>
>>>>> Thomas Lachand-Robert (TLR) wrote at Sat, 15 Dec 2001 14:44:07 +0100:
TLR> Also I discovered today that the "obj" item returned by
TLR> getObjectValue:(id *)obj forString:(NSString *)exprstr
TLR> errorDescription:(NSString **)error
TLR> is supposed to conform to NSCopying, since I got
TLR> *** -[myObjectClass copyWithZone:]: selector not recognized
TLR> Then, the correct declaration should be
TLR> getObjectValue:(id<NSCopying>*)obj forString:...
...I can't make sense of this. First, quite generally:
The "obj" is _made by the formatter and given to you_, not the vice versa.
Therefore, the declaration is quite right: since the returned object is just
plain id, you cannot presume any other behaviour -- especially not that it
conforms to NSCopying.
OTOH, _should_ it be declared "(id<NSCopying>*)obj", _that_ would be wrong
in case the returned object does not conform to NSCopying, which seems to be
your case.
Now, as for particular formatter: since it (if I understand you properly)
returns objects of "myObjectClass" (BTW, class names should _always_ be
capitalized!), we must be speaking of your own formatter. Therefore, if there
is some improper usage of copying in its implementation, well, looks like
your fault, does it not?
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc