On May 29, 2008, at 9:41 AM, Leslie Smith wrote:
because within the documentation for initWithContentsOfFile it says

"Return Value: An initialized object—which might be different than the original receiver ..."
and my original code assumes that the return value is the same object.

This is true of all init methods, by the way. You might want to review the "Object Creation" docs here, in particular "Issues with Initializers":

<http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_6.html >

Make sure you understand the other thing that's been pointed out, which is that init methods are not like other methods that you can call any old time. Init methods are meant to be called exactly once, immediately after alloc, and preferably in the same statement, as in the example Jason Stephenson gave (to avoid errors of exactly this kind).

Unfortunately there is no method called loadContentsOfFile: or replaceAllWithContentsOfFile:. If there were, it would have served your purpose.

--Andy

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to