Re: Memory allocation issues with NSObject and NSString
Re: Memory allocation issues with NSObject and NSString
- Subject: Re: Memory allocation issues with NSObject and NSString
- From: Michael Ash <email@hidden>
- Date: Tue, 20 Jan 2009 00:04:33 -0500
On Mon, Jan 19, 2009 at 6:14 PM, Ben Trumbull <email@hidden> wrote:
>> I sure hope not! The documentation for the method states:
>>
>> "The init method defined in the NSObject class does no initialization;
>> it simply returns self."
>>
>> Making it do anything else would be a serious breach of the API contract.
>
> That is a matter of perspective. And why lawyers plague the world. "no
> initialization" is not the same as "absolutely not a single CPU
> instruction". For example, this tech writer might have meant "no
> initialization of this object", which would be obvious, not realizing that
> someone else would read that and wrongly infer that they could safely skip
> using it correctly as demonstrated in the code box right next to the words.
Perspective, nuts! Given the context, it's about as clear as you could
possibly get that this method does nothing but return self. The use of
the word "simply", the "no initialization" when describing an init
method, the utter pointlessness of the sentence if other work were
being done, it all leads to a single conclusion. Quite frankly, any
tech writer who wrote the above sentence with the intent of allowing
for other activities to take place would be so bad at his job that he
should be fired and replaced by someone competent.
The rest of the discussion is about how to deal with -init in the
general case, not NSObject's specific implementation thereof, so it
does not apply.
I maintain that NSObject -init is guaranteed to do nothing, and
changing this fact would seriously break the API contract.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden