Christophe Weblog Wiki Code Publications Music
initial implementation of support for REPL presentations
authorChristophe Rhodes <csr21@cantab.net>
Tue, 31 Aug 2010 07:54:54 +0000 (08:54 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Tue, 31 Aug 2010 07:54:54 +0000 (08:54 +0100)
commite35149b43e4da28f542c6bdf2decd802e84dd440
tree59e1ddbf8a53a4fd616f39696f330431b5ec01f0
parent2c0d53bc49f3dd18df3227759ba4ff40c8535ee5
initial implementation of support for REPL presentations

There's a lot here that's ugly, unfinished or just downright horrible.
Most notably, presentation support depends on swank-side read-time
evaluation (indicated with Common Lisp syntax, which hilariously is a
comment in R).  We can't support that in general, but we can
special-case the presentation-specific operator.

But then the next difficulty comes along; actually performing that
read-time evaluation needs to happen in a different environment than
the evaluation of the REPL form.  In order to achieve this, we abuse
bquote() the equivalent of Lisp's backquote facility, by calling what
in CL terms would be its macro-function on the parsed, preprocessed
expression; only after doing that (and hence resolving the `read-time'
evaluations) do we evaluate the call itself.

The implementation of presentation protocol messages is also slightly
ugly; having to implement cl:nth-value is particulraly horrible, but
the lack of weak references / weak tables in R (at least as far as I
can tell at the moment) is a cause of niggling concern.
swank-presentations.R [new file with mode: 0644]
swank.R