News for hackers. Stuff that matters.
Re:Task.js: Beautiful Concurrency for JavaScript by derefr on Thursday April 25, 2013 @02:26AM (#5605965)
Huh; I wonder if a slight tweak to this could be used to make yield act like Erlang's receive operator? Presuming the library assigns every task a handle (a PID), that tasks could .send() messages to other tasks, etc., .receive() could be implemented by the library just expecting you to yield a set of patterns, then blocking your task until the library has a message to route to it that matches one of those patterns.
Re:Task.js: Beautiful Concurrency for JavaScript by fzzzy on Thursday April 25, 2013 @07:41AM (#5606633)
Yep. I wrote some code a few years ago that does this. I wrote it before I knew about task.js and should rewrite it using task.js, removing my handrolled clone of it.

https://github.com/fzzzy/pavel.js

There is also another slightly different scheduler that I started that includes a multithreaded scheduler with webworkers and works in a browser. This version, because it is designed to work in stock browsers, has a callback api and does not use generators, but task.js could easily be layered on top.

https://github.com/fzzzy/actors.js

Please excuse the use of an explicitly provided "pattern" string in both of these. I did it for simplicity. It would be possible to port my concept of shapes from my python-actors project to js, but the runtime overhead of using explicit strings is extremely low and it makes the code very simple.

Re:Task.js: Beautiful Concurrency for JavaScript by kevingadd on Thursday April 25, 2013 @04:44AM (#5606243)
I think in practice you could just do this with encapsulation - i.e. you'd create channel objects and yield on them, instead of assigning handles directly to tasks.