On Mon, Aug 5, 2013 at 1:51 PM, Tim Caswell <[email protected]> wrote:

> A great example of this separation is how I use generators in js-git.  The
> library is entirely callback based.  I make all my external facing API
> functions work in dual mode as node-callback-last or return-continuable
> style with a single line at the top:
>
> function readFile(path, callback) {
>   if (!callback) return readFile.bind(this, path);
>   ...
> }
>

Since it's actually this simple to cleanly support generators in node core
this might be an addition worth talking about down the line if generators
become popular (big if).

I actually think the above is a nice pattern and will start adopting it
into my code.

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

--- 
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to