News for hackers. Stuff that matters.
Re:Ask PG: Is HN Expired Link Eventual Fix Planned? by wlievens on Monday January 13, 2014 @02:29AM (#7049366)
A closure is a function augmented with implicit references to the context in which it was created. In case of an upvote link it would hold references to the post you could upvote. That reference exists not in the URL but in the closure at the servers side. If you keep these objects in memory indefinitely, you'll run out of ram.
Re:Ask PG: Is HN Expired Link Eventual Fix Planned? by elwell on Monday January 13, 2014 @02:39PM (#7052782)
Oh, I was assuming some sort of custom implementation for doing that. If it's just hanging around in RAM, fair enough; can't see how that has scaled so well, but hey.
Re:Ask PG: Is HN Expired Link Eventual Fix Planned? by wlievens on Monday January 13, 2014 @03:14PM (#7052975)
Well, a closure can't be more than a couple hundred bytes, I guess.

If he wants to continue with that technique, I'd hack it like this: use reflection to crawl the closure, isolate the variables bound to the closure context, serialize those (the user id's, post id's, etc). Then the closure code, which will be one of only a few "templates", can be put into a global dictionary. The serialized state goes into the URL parameters. The closure is collected, and "reified" from the global dictionary and URL state once the user performs the action.

I don't know if LISP's reflection can pull this off, but I'm pretty sure it's no biggie.