5 ms·
Instead everyone in the Lisp community (pg included) is still enamored with using continuations to produce ugly URLs and unmaintainable web applications. If yo
by pg 16y ago
Instead everyone in the Lisp community (pg included) is still enamored with using continuations to produce ugly URLs and unmaintainable web applications.
If you read the source of HN, you'll see that it doesn't actually use continuations.
I find the source of HN very clear. Have you read it? Is there a specific part you found so complicated as to be unmaintainable?
- axod 16y ago> If you read the source of HN, you'll see that it doesn't actually use continuations. > It had to be some dialect of Lisp with continuations, which meant Scheme, and MzScheme seemed the best. (From further down the page). I'm confused. What needs continuations?
- dauphin 16y agoErrors/exceptions, for one, are implemented using continuations.
- axod 16y agoSounds terribly inefficient to me, but what do I know -shrug-
- dauphin 16y agoYou know, if it weren't really impratical, numbers in Arc would be represented by Church numerals, "hash tables" would be alists, strings would be lists, etc. That's a credo :-)
- jrockway 16y agoAll control flow is a subset of continuations. The stack is a continuation (calling a function is call-with-current-continuation, return is just calling the "current continuation"), loops are continuations (with the non-local control flow, like break/last/redo/etc.), exceptions are continuations (like functions, but returning to the frame with the error handler), etc. Continuations are the general solution to things that are normally treated as different. So continuations are just as efficient (or inefficient) as calling functions or throwing exceptions. In a web app context, though, it's kind of silly to keep a stack around to handler something like clicking a link that returns the contents of database row foo. People do this, call it continuations, and then run into problems. The problem is not continuations, the problem is that you are treating HTTP as a session, not as a series of request/responses. (The opposite of this style is REST.)
- ezalor 16y agoEat this: "The continuation that obeys only obvious stack semantics, O grasshopper, is not the true continuation." -- Guy Steele
- sedachv 16y agoIn theory yes, in practice you need to reify the stack (even for one-shot continuations). Clinger, Hartheimer and Ost have a really good survey paper of the different ways to do that: http://www.scribd.com/doc/47221367/Clinger-Implementation-Strategies-for-First-class-Continuations http://www.scribd.com/doc/47221367/Clinger-Implementation-St...
- pg 16y agoI just wanted to have them in the language. The fact that I don't currently use them in HN doesn't mean they're useless.
- sedachv 16y agoPagination/"More" uses fnids; looking at the source it's a callback, but from an HTTP client perspective it might as well be a continuation. How do you test and debug things like that that have random URIs and function names and get GCed on a regular basis? That's what I mean when I say continuations lead to unmaintainable web apps.
- pg 16y agoI've been using this technique since 1995 and it has never once been a problem. It's an instance of programming with closures, which has been common in the Lisp world for even longer. One doesn't need to examine something represented as a closure any more than one needs to examine a particular invocation of a recursive function. Perhaps the reason I've never had a problem is that I've been careful to use this technique in fairly restricted ways. Lisp macros are the same sort of thing. They could yield unreadable code if abused. But good programmers use them in principled ways, and when used with restraint they are clearly a net win.
- blasdel 16y agoIt's a problem for me when the fnids in every reply <form> cause them to expire several times a day when the server crashes. Edit: also when the server redirects me back to the wrong origin, I was sent to http://news.ycombinator.com/threads?id=pg http://news.ycombinator.com/threads?id=pg instead of http://news.ycombinator.com/item?id=2120756 http://news.ycombinator.com/item?id=2120756 after posting this reply initially.
- pg 16y agoalso when the server redirects me back to the wrong origin Sounds like that could be a bug. Was http://news.ycombinator.com/item?id=2120756 http://news.ycombinator.com/item?id=2120756 the page you were on when you replied?
- blasdel 16y agoYes, I clicked the reply link on your comment from there. I figured you had to know about this bug, since it happens to me regularly (maybe 10% of eligible comments) when I comment in active threads during standard procrastination hours. The misdirect is usually to the threads page of a user further up the comment tree, though sometimes it's to the permalink of a grandparent comment. Seems like you're mixing up the redirects of concurrent users but never across comment hierarchies so it's not omnipresent.