Hi Brian,
I think you are misunderstanding what that section is about. It is
just describing how the system is implemented. There's basically
nothing in there that you need to know as user other than "It may take
a while to compile." For instance, you don't worry about the fact that
all tree-like functions in your normal Racket code are eventually
turned into linear sequences of assembly. Those changes to your code
discussed in 3.2 are things that happen in the compiler, you don't
need to do anything, just like you don't need to think about register
allocation when you write normal programs, but it happens behind the
scenes.
Nothing described in section 3 happens to your code unless you write
in `#lang web-server` or `#lang web-server/base`. You can use or not
use continuations and use or not use this library... they are totally
orthogonal. There is basically no program that you can write in one
that you can't write in the other, as long as you call the appropriate
version of `send/suspend`.
The whole point of this library is to write code as-if it were
stateful, but the compiler automatically makes it stateless. If you
are comfortable programming directly with inverted control, then go
right ahead and implement the stateless stuff yourself. Both ways are
going to be equally efficient, although the `#lang web-server` library
will be guaranteed to do it correctly and make it easy to do stuff
like encrypt and sign the state you store on the clients.
As far as using `serve/servlet` or not, the implementation of it is
really simple [1] in case you want to adapt it. I don't recommend
using the lift dispatcher directly. You probably want to use
`dispatch/servlet`. Remember, in Racket, a servlet is just a function
from request to response, with some resource control. It doesn't
impose any programming style or other costs on you. I get the
impression from your comments that you are really nervous about some
sort of costs imposed by using Racket libraries and think you will get
some benefit by being "low-level". This is probably misguided and just
based on some misunderstandings.
Jay
1.
https://github.com/racket/web-server/blob/master/web-server-lib/web-server/servlet-env.rkt#L156