TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Defer: Taming asynchronous javascript with coffeescript

69 pointsby gfxmonkalmost 15 years ago

6 comments

pcalmost 15 years ago
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 未加载
jashkenasalmost 15 years ago
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.
axodalmost 15 years ago
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 未加载
_deliriumalmost 15 years ago
Apart from being a cool bit of tech, this is a really good writeup.
cagefacealmost 15 years ago
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 未加载
Mathnerd314almost 15 years ago
Why not call it callCC instead of defer? Aside: great intro to continuations, I now understand them!
评论 #1485456 未加载