If your function is asynchronous only sometimes, consider getting rid of
that ambiguity by using process.nextTick() on your callback in the cases
where calling it won't be async.

On Thu, Apr 12, 2012 at 2:27 AM, Jorge <[email protected]> wrote:

> On Apr 11, 2012, at 2:16 AM, Joe Ferner wrote:
>
> > (...) Methods with callbacks are not required to have async code in
> them, they just generally do. If you replace doIt with say a
> getUserFromCache method where 99% of the time you get cache hits and the
> function just returns the user this would be completely valid (...)
>
> You can do that but I think the consensus is that it's not a good idea
> because it complicates reasoning about your code:
>
> method(params, cb);
> doSomethingElse();
>
> Will doSomethingElse() run before or after cb() ?
> --
> Jorge.
>
> --
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>



-- 
*Roly Fentanes*
[email protected]
480 200 3369

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to