Re: NSError: why returned directly?
Re: NSError: why returned directly?
- Subject: Re: NSError: why returned directly?
- From: j o a r <email@hidden>
- Date: Wed, 26 Apr 2006 11:54:08 +0200
On 26 apr 2006, at 07.11, Scott Anguish wrote:
The way that NSErrors are typically returned is by-reference
parameters .
I think that Ondra is well aware of this, and that his question is
more on _why_ it is this way.
I agree with Ondra in that I think that it's a bit unfortunate that
we start to see this "withError:(NSError **)outError" suffix on so
many new methods in Cocoa. I really like that we get a formalized way
to return error objects, but I don't particularly like the way it's
implemented. A couple of reasons:
1) You have to change all method signatures
2) It's very easy to make mistakes when you return objects via by-
reference parameters
3) By-reference parameters are difficult for newbies, and not "in the
spirit" of Cocoa [*]
Why not use a global per-thread variable to store the current NSError
instead of returning it as a parameter (like errno in C libraries)?
j o a r
[*] What percentage of methods - in all of Cocoa - used by-reference
parameters before the introduction of NSError?
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden