Subject: Re: Harmony - proxies | asynchronous
Dmitry Soshnikov
dmitry.soshnikov at gmail.com
Mon Sep 5 14:37:17 PDT 2011
On 03.09.2011 1:26, 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!
> Mikeal: We don't want threads!
>
> If I'm on the right track, then I should understand how this relates
> to proxies. But I don't. Any hints?
>
Don't be worry :) the topic is a little bit changed. Initially it was
asked how to provide asynchronous property readings (proxy's `get` trap,
or a simple accessor's get which call some deferred action) in the
syncronious view. And consuming generators (being a technique of
implementation of cooperative processes) allow to do this, since can
suspend a process and resume it from the next line, i.e. representing
asynchronous in syncronious view.
But, that's said, even more elegant of such a technique would be either
syntactic transformation at compilation level, or creation of implicit
task-wrapper with a sugar for `yield` in this case. Regarding not using
`yield` for improving asynchronous programming -- I also didn't
understand the reasons. Because currently programming in Erlang (which
have the same "green thread" which are managed by an _implicit_
scheduler) I can say that Node.js's spagetty-code with nested callbacks
just, sorry, sucks in comparison with Erlang's which is also
asynchronous, but allows to write it all in the synchronous manner.
Though, the topic is not about Erlang...
Dmitry.
More information about the es-discuss
mailing list