TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

StratifiedJS: Javascript + structured concurrency

53 点作者 danh超过 13 年前

4 条评论

olegp超过 13 年前
If you prefer vanilla JS and are only working with Node, you should check out <a href="https://github.com/laverdet/node-fibers" rel="nofollow">https://github.com/laverdet/node-fibers</a>. I use it in my <a href="https://github.com/olegp/common-node" rel="nofollow">https://github.com/olegp/common-node</a> package to address the same issues as those tackled by StratifiedJS.
skrebbel超过 13 年前
I'm probably missing something, but isn't this race condition galore? As per the front page example:<p><pre><code> var news; waitfor { news = http.get("http://news.bbc.co.uk"); } or { hold(1000); news = http.get("http://news.cnn.com"); } or { hold(1000*60); throw "sorry, no news. timeout"; } show(news); </code></pre> This starts the first 'or' clause the moment the http.get(BBC) suspends, which it does quickly because http.get is async. Now, if the BBC get returns <i>just</i> after my hold(1000) has completed but before http.get(CNN) had the time to really launch the http request and suspend, i'll have done the CNN get for nothing.<p>Of course in this case this only means a wasted request. But what in case of side effects?
评论 #3538866 未加载
评论 #3538472 未加载
jashkenas超过 13 年前
After the IcedCoffeeScript post the other day, I found Oni Labs' version -- which I don't remember seeing before -- Stratified CoffeeScript:<p><a href="https://github.com/onilabs/coffee-script" rel="nofollow">https://github.com/onilabs/coffee-script</a>
beggi超过 13 年前
Eliminating nested callbacks would be one hell of a feat.
评论 #3537551 未加载