I've been following async to sync discussions for years but I have one 
fundamental question.  Is it possible to wrap an async function in a 
library such that it can be called from code that is written expecting a 
sync function?  In other words could I make a library containing a 
readFileSync function that uses fs.readFile?

Using something like generators inside the library is legal as long as the 
caller isn't aware of this.  Requiring the caller code to do a transpile is 
not legal.

I should mention that this is for a node environment emulation that places 
calls over the network using proxies.  The readFileSync code obviously 
can't go in a busy-wait loop waiting for the result from the net.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/be0f485e-23a5-4af4-b059-9f9c7f609553%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to