[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Paul Graham <email@example.com>] Re: What is a lightweight language
- To: address@hidden
- Subject: [Paul Graham <firstname.lastname@example.org>] Re: What is a lightweight language
- From: address@hidden
- Date: 12 Dec 2001 10:53:42 -0500
- Sender: address@hidden
- User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service (Windows))
Paul Graham forgot to forward this response.
I put my response to his response at the end.
From: Paul Graham <email@example.com>
Subject: Re: What is a lightweight language
What you need continuations for is to make web pages that
behave like subroutines of other web pages, e.g. a color-picker
page that can "return a value" to a page that "calls" it.
This is so far removed from the cgi script model of web
sessions that people tend not to even think of it, but it is
doable and can be a huge win in apps.
We did this in Viaweb (see http://www.paulgraham.com/lwba.html
for details) and I'm writing a library of utilities for doing
it right now for Arc.
As in many uses of continuations, you don't actually need
call/cc-- you can fake continuations using carefully constructed
closures-- but having call/cc makes it cleaner and easier.
--- firstname.lastname@example.org wrote:
> Shriram Krishnamurthi <email@example.com> writes:
> > We're fixing that. Dorai Sitaram's "Teach Yourself Scheme in
> > Days" is the opening salvo; I like to think "How to Use Scheme"
> > 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
> > which sends a Web page, suspends the computation, and resumes it
> > resume automatically when the user responds like nothing happened
> > between. And the fact that SEND/SUSPEND is a fancy name for
> > CALL-WITH-CURRENT-CONTINUATION ... well, nobody needs ever know
> 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
> 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
> is another web page (or other mime object). A plain old link would
> 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
> 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
> It doesn't seem to me that you need continuations for this problem.
Here is my response to his response:
I see how cwcc could be used for `subroutines', but I probably would
have used CPS (fake it with closures) instead.