You have (maybe unknowingly) started a very long thread here.  There are
many vocal proponents of different ways to make an async call look
synchronous.  There are also many vocal proponents of keeping it async and
only using callbacks.

But to answer your question a bit, there is no simple way to avoid
callbacks.

On Sun, Mar 18, 2012 at 5:23 PM, Angelo Chen <[email protected]>wrote:

> Hi,
>
> got this :
>
> function get_next_id() {
>        rclient.incr("next_id", function(err, reply) {
>                        return reply
>        });
> }
>
> will call this with:
>
>   var next_id = get_next_id()
>
> this won't work, because function returns even before 'reply' was
> taken from rclient( a redis), one solution is, passing a call back to
> the function, is there any other way? thanks.
>
> Angelo
>
> --
> 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
>

-- 
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