[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is a lightweight language
Shriram Krishnamurthi <sk@cs.brown.edu> writes:
> We're fixing that. Dorai Sitaram's "Teach Yourself Scheme in Fixnum
> Days" is the opening salvo; I like to think "How to Use Scheme" will
> be the main artillery. It talks about problems and describes their
> solutions. One of these problems will be building interactive Web
> services. And its solution will be to use the primitive SEND/SUSPEND
> which sends a Web page, suspends the computation, and resumes it
> resume automatically when the user responds like nothing happened in
> between. And the fact that SEND/SUSPEND is a fancy name for
> CALL-WITH-CURRENT-CONTINUATION ... well, nobody needs ever know that.
I'm curious about this. I was implementing a web server in Scheme
years ago (writing web servers must be an initiation rite) and I came
to the conclusion that call-with-current-continuation was not the tool
for the job, but that LAMBDA was.
A web page could be considered a data structure with embedded lambda
expressions in it. The lambda expression is a link or a form.
Clicking on a link causes a remote procedure call, the result of which
is another web page (or other mime object). A plain old link would be
a lambda expression with no arguments while a form would be a lambda
expression with arguments. The `session state' would be the lexical
environment. Ideally, the web page writer could just plop a lambda
expression down in the source, and the web server would figure out how
to capture the lexical environment and reify in such a way that it
could be sent over the net (via a cookie, encoded in the url, or
somesuch). The web server would also figure out the correct
`presentation' of the generated closure: as a hyperlink or form (or
ISINDEX).
It doesn't seem to me that you need continuations for this problem.
~jrm