[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Paul Graham <paulgraham@yahoo.com>] Re: What is a lightweight language
- To: address@hidden
- Subject: [Paul Graham <paulgraham@yahoo.com>] 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 <paulgraham@yahoo.com>
Subject: Re: What is a lightweight language
To: jmarshall@mak.com
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.
--pg
--- jmarshall@mak.com wrote:
> 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
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.
~jrm