Hacker News new | ask | show | jobs
by t0mpr1c3 30 days ago
Paul Graham glosses over the details: writing LISP in continuation passing style is not for the faint hearted. For a modern implementation that hides the gnarly stuff, see https://docs.racket-lang.org/web-server/stateless.html

The disadvantage of this kind of stateless server is that you need to keep around a hash full of continuations, basically one for every page visit. Each of these continuations contains an entire environment and stack, and you have to manage all that memory allocation somehow. You need to serialize the continuations in order to cache them. Then you need to figure out which ones to keep around.

Authentication is potentially also an issue because absent some other security mechanism, anyone who knows the hash of the continuation can visit the page with the same permissions as the original user. https://docs.racket-lang.org/web-server/faq.html (10.7)

Apparently this website runs on LISP so I would be interested to know how it works under the hood. For me, anything more than a SPA seemed like too much pain.

2 comments

Using delimited continuations in a web framework is magic. In remember the first time I saw things like pharo and wodered how it was even possible. Doing that stuff in Python is still hard. Doing it in racket is easy peasy.
A BEAM process per user would have similar advantages, is pretty memory efficient, and does not need a lot of extra work.