[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Continuations



>>>>> "Bruce" == Bruce Lewis <brlewis@ALUM.MIT.EDU> writes:

Bruce> Michael Sperber <sperber@informatik.uni-tuebingen.de> writes:

Scott> A binding is part of the state, right? 
>> 
>> Not where I come from :-) But I guess that's a matter of terminology.

Bruce> Here, I think, is the main source of confusion.  Folks like Michael
Bruce> Sperber are saying "a continuation captures the state of the
Bruce> computation".  Using a Turing machine model, they're thinking of those
Bruce> little circles in the finite state machine, and not of the contents of
Bruce> the tape.

Right.  Applied to this scenario, I realized that the distinction *is*
important when it comes to Web programming:

"State" is something about the world.  Let's say it's something like
the balance on my online account.  I change it by pressing buttons
labelled something like "Buy NOW!" or something.  These things don't
get revoked when I press the Back button on my browser.  Thus, a
(possibly persistent) store is the right medium for carrying this kind
of stuff, and mutation is the right operation.

On the other hand, where I am within a session isn't state because
it's not about the world---it's about what browser window I'm looking
at.  This is about binding because it's about the context I happen to
be operating from, and mutation is the wrong operation:  I don't want
what I do in this window to affect other windows.  Thus, conflating
the two notions (whether in terminology or some hodgepodge "session
state object") is a bad idea.

(Of course, binding and assignment/mutation are often confused by
programmers, with about the same problems.)

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla