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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Defer: Taming asynchronous javascript with coffeescript

69 点作者 gfxmonk将近 15 年前

6 条评论

pc将近 15 年前
Nitpick: the beautiful thing about Smalltalk's continuation support is that it's <i>not</i> provided by the compiler. (As far as I know, Squeak still doesn't ship with continuation support built-in.)<p>Despite this, because stack frames are first class objects in Smalltalk, it's very easy for the user to implement continuations. You just traverse the stack to capture the continuation, and switch stack frames with the continuation's in order to invoke it. The resulting Continuation class is almost improbably literal in its implementation.<p>This is what frameworks like Seaside do.
评论 #1485383 未加载
jashkenas将近 15 年前
For extra reading material for the curious, the history of the proposed implementation of "defer" in CoffeeScript:<p>Part I: <a href="http://github.com/jashkenas/coffee-script/issues/issue/241" rel="nofollow">http://github.com/jashkenas/coffee-script/issues/issue/241</a><p>Part II: <a href="http://github.com/jashkenas/coffee-script/issues/issue/287" rel="nofollow">http://github.com/jashkenas/coffee-script/issues/issue/287</a><p>Part III: <a href="http://github.com/jashkenas/coffee-script/issues/issue/350" rel="nofollow">http://github.com/jashkenas/coffee-script/issues/issue/350</a><p>If you have a suggestion for how to handle the bits of "defer" that are still undecided, such as how to handle the "return" statement, and enforce a callback parameter, please feel free to add it to the third ticket.
axod将近 15 年前
Good intro to continuations, but just reinforces the reasons I dislike them and wouldn't use them.<p>Also disagree about "What is asynchronous programming, and why is it so damn awkward?"<p>It's not awkward in the least. Either you write your code to remember the things you need to remember, or you use something like continuations which will be pretty inefficient and ugly (IMHO).
评论 #1485479 未加载
评论 #1485477 未加载
_delirium将近 15 年前
Apart from being a cool bit of tech, this is a really good writeup.
cageface将近 15 年前
Things like Coffeescript and Objective-J make me nervous. Javascript is flawed certainly but building a completely new language on top of it feels too radical. An abstraction like that seems bound to be leaky and it doesn't seem like you'll ever completely escape working with other native JS pieces so why not stick to a single, common syntax with good tool support, tutorials, docs, libraries etc? Javascript's not that bad a language once you establish some conventions.
评论 #1486690 未加载
评论 #1486572 未加载
Mathnerd314将近 15 年前
Why not call it callCC instead of defer? Aside: great intro to continuations, I now understand them!
评论 #1485456 未加载