Re: cocoa-dev digest, Vol 2 #2711 - 14 msgs
Re: cocoa-dev digest, Vol 2 #2711 - 14 msgs
- Subject: Re: cocoa-dev digest, Vol 2 #2711 - 14 msgs
- From: Marcel Weiher <email@hidden>
- Date: Tue, 29 Jul 2003 07:13:49 +0100
[ -ofProcessedString ]
Yes. In this case, indubitably. Bad coding in OF, or bad choice of
method name. It translates as "the string that results from
ofProcessingObject's processing", not "the <property> of
ofProcessingObject". I'd say this is the exception that proves the
rule.
I'll interject here, since I may very well make coding changes in OF
based upon this thread. :-)
First, since there is no processedString method in OmniFoundation, I'm
assuming that Fritz was making a generic example and not talking about
a specific method name. Thus, "bad choice of method name" doesn't
really apply here.
If you saw these methods (some of many in OF):
- (NSString *)stringByUppercasingAndUnderscoringCaseChanges;
- (NSString *)stringByRemovingSurroundingWhitespace;
- (NSString
*)stringByCollapsingWhitespaceAndRemovingSurroundingWhitespace;
- (NSString *)stringByRemovingWhitespace;
- (NSString
*)stringByRemovingCharactersInOFCharacterSet:(OFCharacterSet
*)removeSet;
- (NSString *)stringByRemovingReturns;
- (NSString *)stringByRemovingString:(NSString *)removeString;
- (NSString *)stringByPaddingToLength:(unsigned int)aLength;
- (NSString *)stringByNormalizingPath;
Would you expect that calling, for instance,
-stringByRemovingWhitespace might return the same string object if
there was no whitespace in it?
Welll, 'stringBy...' does strongly suggest that you are creating a new
string here. Furthermore, since these seem to be methods on NSString
returning NSStrings, they are also quite different from "accessor"
methods.
Should it be retained and autoreleased because this isn't a property
of the original string? Or would it be preferable just to document
this possibility and avoid the autorelease?
I wouldn't go as far as saying it should be retained/autoreleased, but
in this case I don't think it would hurt, much... ;-)
I know now what Fritz' expectation would be (by the way Fritz, did you
ever report this as a bug? I don't remember seeing anything about
it...)
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
_______________________________________________
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.