[Seaside] Re: Using closures to create continuations

Avi Bryant avi.bryant at gmail.com
Fri Mar 25 17:28:26 CET 2005

On Fri, 25 Mar 2005 18:04:44 +0200, Andrei N.Sobchuck
<andrei.sobchuck at gmail.com> wrote:

> AB> And so on.  Not to mention that in Java the above example would be
> AB> about 50 lines long and have 17 casts because anonymous inner classes
> AB> are so verbose.
> I think, the main is that it's possible to implement such framework
> on current VM's. As for the syntax - it's possible to create language that
> will use CPS implicitly.

If the question is "can such a framework run on the JVM", the answer
is clearly yes: the JVM is Turing complete, after all.  More
concretely, SISC Scheme gets a lot of use in this area; see Chris
Double's work in particular.  Cocoon also uses the Rhino Javascript
interpreter for this purpose.  I thought the question was if it could
be done in Java, the language - and the answer there is still "not
without a lot of pain".  If you want to use Java IDEs, Java debuggers,
etc, etc, you're going to have to jump through a lot of hoops to make
it work.

> As far as I know ViaWeb also did use closures and
> there was problems with back button.
> So, at now it's possible to create full framework on closures, is it right?

This is somewhat tangential, but you're speaking as if closures are a
VM feature; they're not, they're a language feature.  Closures and
objects are equivalent, and a compiler can translate either one to the
other as necessary.  The "anonymity" of blocks in Smalltalk or
anonymous inner classes in Java is just syntactic sugar for
instantiating an object of a particular class.  Conversely, in Scheme
it's very common to use closures to build object systems.


More information about the Seaside mailing list