[1] http://en.wikipedia.org/wiki/Continuation#In_Web_development
EDIT: to all the people arguing with me. Read the source code to Hacker News.
(= fns* (table) fnids* nil timed-fnids* nil)
; count on huge (expt 64 10) size of fnid space to avoid clashes
(def new-fnid ()
(check (sym (rand-string 10)) ~fns* (new-fnid)))
(def fnid (f)
(atlet key (new-fnid)
(= (fns* key) f)
(push key fnids*)
key))
(mac afnid (f)
`(atlet it (new-fnid)
(= (fns* it) ,f)
(push it fnids*)
it))
They are in memory. Which is why they expire randomly when the HN process is restarted.In the Racket process that's running the Arc code for news.yc
"Any sufficiently complicated Lisp program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of an actual database."
Racket does have an option to serialize the continuations, gzip them, sign them with HMAC, and then send all of that to the client so the server doesn't have to keep track of anything, but HN doesn't use it.
See http://docs.racket-lang.org/continue/#(part._.Advanced_.Cont... for a quick introduction.
https://github.com/wting/hackernews
Arc runs on Racket:
http://en.wikipedia.org/wiki/Arc_(programming_language)
See the "OS" section where it says "runs on the Racket compiler"
See also the Arc source code, https://github.com/Pauan/ar/blob/arc/nu/arc Note the "#lang racket" at the top.
Way back I wrote a bunch of documentation on the Arc web server if you want details: http://www.arcfn.com/doc/srv.html Look at harvest-fnids which expires the fnids.
The fnid is an id that references the appropriate continuation function in an Arc table. The basic idea is that when you click something, such "more" or "add comment", the server ends up with the same state it had when it generated the page for you, because the state was stored in a continuation. (Note that these are not Scheme's ccc first-class continuations, but basically callbacks with closures.)
(The HN server is written in Arc, which runs on top of Racket (formerly known as PLT Scheme or mzscheme))
Edit: submitted in multiple parts to avoid expired fnids. Even so, I still hit the error during submission, which seems sort of ironic.
This way seems impractical, TBH. Certainly for the user - the expiration a bit of a nuisance, as I'll get it more often than not if I read a couple of stories and then click 'More'.
[addendum] I Reread your comment and realized that wasn't what you meant at all. What would be the benefit of path based uris over query string params in hn's case? I only see how they be equal, not better.
URL data can come from path or query string, it doesn't matter.
https://news.ycombinator.com/page3/x?fnid=b7VO4wED8MRumCeiX5...