Oliver,

Node has two very different API styles:

1) The callback style where the callback is called exactly once and 
receives (err, result) arguments
2) The event style where the callback may be called multiple times with 
event data and where errors are dispatched as a separate "error" event. The 
event handlers take varying number of arguments (usually one).

Looks like you want to align 2) on 1) by adding an error parameter to event 
handlers. Sounds wrong as errors already have their own event and this 
would mean extra code in every event handler to check for errors.

fs.exists is an anomaly because it is a style-1 callback API (callback 
invoked exactly once) with a non-standard callback signature.

Bruno

On Friday, June 1, 2012 9:03:04 PM UTC+2, Oliver Leics wrote:
>
> tl;dr 
>
> On Fri, Jun 1, 2012 at 8:41 PM, Alan Gutierrez <a...@prettyrobots.com> 
> wrote: 
> > On 6/1/12 3:16 AM, Oliver Leics wrote: 
> >> 
> >> On Fri, Jun 1, 2012 at 7:50 AM, Alan Gutierrez<a...@prettyrobots.com> 
> >>  wrote: 
> >>> 
> >>> Never confused me. The (err, result) signature means one thing. This 
> >>> means 
> >>> another. Not very confusing at all. Note: I'm people. 
> >> 
> >> 
> >> Good for you :) BTW: You are not people, you are you. 
> > 
> > 
> > I believe you're making a talisman of "consistency", where you're 
> choosing 
> > an arbitrary construct in the text, function signatures of functions 
> passed 
> > to API functions, and turning them into a fetish. 
> > 
> > If I can get all the chairs in the office to point in the same 
> direction, 
> > the office will be more organized. 
> > 
> > Taking an arbitrary aspect of the API and making it fixed will sew 
> confusion 
> > for people when the fixture does not accurately express the purpose of 
> the 
> > callback. 
> > 
> > The purpose of the callback to create a server is to register an event 
> > handler for zero, one or more request events. The purpose of the 
> callback to 
> > `fs.readFile` is to respond to a single event, guaranteed to occur once 
> and 
> > only once. 
> > 
> > Adding the error as the first argument to the callback for the server's 
> > request handler forces the server to place a block of error handing code 
> at 
> > the head of the request handling function, when only a subset of the 
> total 
> > set of server errors will occur just prior to executing the event 
> handler. 
> > 
> > What errors actually get passed to this server handler? Can you answer 
> that 
> > question in a way that is less confusing to the venerated newbie than 
> simply 
> > saying, "oh, no, this is different from the callbacks your learned about 
> in 
> > `fs`, error handling is a separate event?" 
> > 
> > -- 
> > Alan Gutierrez - @bigeasy 
> > 
> > 
> > -- 
> > Job Board: http://jobs.nodejs.org/ 
> > Posting guidelines: 
> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
> > You received this message because you are subscribed to the Google 
> > Groups "nodejs" group. 
> > To post to this group, send email to nodejs@googlegroups.com 
> > To unsubscribe from this group, send email to 
> > nodejs+unsubscr...@googlegroups.com 
> > For more options, visit this group at 
> > http://groups.google.com/group/nodejs?hl=en?hl=en 
>
>
>
> -- 
> Oliver Leics @ G+ 
> https://plus.google.com/112912441146721682527 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to