Subject: Re: Harmony - proxies | asynchronous

Brendan Eich brendan at mozilla.com
Fri Sep 2 15:48:20 PDT 2011


On Sep 2, 2011, at 2:26 PM, John J Barton wrote:

> I'm pretty puzzled by this discussion and I'm guessing other folks might be puzzled as well. Since I understood node fibers as "thread for Node", the discussion I read is:
> 
>    /be: You can have threads!

I did not say that. Remember, threads suck.

Generators are not threads.  Generators are shallow one-shot continuations. They do not even imply an event loop turn per yield. But they are co-expressive with, and more primitive than, deferred/async functions (now that we have PEP-380 style return e; from generator body).

With generators one can build up a variety of async libraries that do not require manual CPS conversion via the dreaded function-expression nest.


>    Mikeal: We don't want threads!

Again the issue is not threads. It is what idiom or keyword signals the reader that a voluntary suspension point has been reached and later or deeper-nested code runs in a different turn (or *may* run in a different turn).

Node.JS is a single-threaded server and always will be. No threads, not even cooperatively scheduled.


> If I'm on the right track, then I should understand how this relates to proxies. But I don't.  Any hints?

Proxies are handy for making promises have an API that looks like plain old object API. obj.foo instead of obj.get("foo"), etc.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110902/31767464/attachment.html>


More information about the es-discuss mailing list