Op 7-10-2010 18:12, Jean-Daniel Dupas schreef:

Le 7 oct. 2010 à 18:04, Kyle Sluder a écrit :

On Thu, Oct 7, 2010 at 12:47 AM, Remco Poelstra<[email protected]>  wrote:
While still in the process of cleaning up my code, I read in the documentation 
of NSObject that -init should return nil if it fails to initialize. But a 
paragraph lower it's stated that -init should always return a functional 
instance or raise an exception. Isn't that in conflict with the allowance of 
returning nil?

File a documentation bug. I would imagine the paragraph about the
exception is saying that an exception must be raised rather than
returning a half-constructed instance of the object.



I agree. The "must raise an exception"  is a bug in the documentation IMHO.
There is a lot of recent API that used the 'return nil' pattern (especially 
methods design to return an NSError by ref).

Ah, I see. I hoped it was 'the new way to go'. I like to more than checking for nil, but I might be a bit lazy :)
I'll file a bug to get the docs updated.

Regards,

Remco Poelstra
_______________________________________________

Cocoa-dev mailing list ([email protected])

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