[slime-devel] broken clojure REPL

Steven E. Harris seh at panix.com
Sat Jan 9 15:23:08 UTC 2010


"Tobias C. Rittweiler" <tcr at freebits.de> writes:

> The point is that you're not trying to use a Lisp reader to read what
> looks very much like Lisp forms, but you're trying to use the Clojure
> reader. And the Clojure reader is very restrictive in what it accepts
> as symbols.

Well, I wrote "Lisp" as opposed to "Common Lisp" to generalize the
complaint. One can imagine SLIME having originated for some Lisp that
allowed symbols like ":::foo", which the Common Lisp reader would not
read without complaint. Are we not biased in this debate due to SLIME
having been made for Common Lisp?

> The easiest compromise is to change %CURSOR-MARKER% to +CURSOR-MARKER+
> which, if I read the documentation right, the Clojure reader will
> accept.

It would not accept the "swank::" prefix, due to the double colon, but
the plus is accepted where the percent sign is not.

> Doing so, is sweeping a problem under the carpet.

Yes, I agree, insofar as either protocol participant is using a parser
(be it the Common Lisp, Clojure, or ELisp reader) that isn't just
reading a string.

However, to recommend that the protocol participants implement a parser
from scratch to read these Lisp forms seems unreasonable too; after all,
the protocol looks to have been designed for writing and reading Lisp
forms directly. It can't just be an accident that there are paired
parentheses and keyword-style tags.

> I still think that it is Clojure that should "change". It should
> provide a way to READ in a form with minimal processing -- something
> that CL's reader, for instance, does not really allow to unfortunate
> consequences.

That would be convenient, but also isn't fair, in light of my suggestion
above about a symbol like ":::foo". I don't have an example of a symbol
that Clojure can read and CL can't, but if the situation were reversed
and Swank had been implemented first in Clojure, would you advocate that
CL should be changed to play along?

Does using the protocol require a parser separate from a
lowest-common-denominator Lisp reader? If so, would you introduce syntax
that the Common Lisp reader couldn't accept?

> It is useful to be able to minimally READ in a possibly untrusted data
> file -- without processing of reader macros, without interning. You get
> back forms of numbers, symbols (whose symbol-name is exactly the
> original textual representation), and possibly other data types that you
> allow by enabling their reader macros.
>
> Has anyone brought that up on a Clojure devel list?

Not that I've seen, no. This subject came up again in the context of a
thread¹ I joined on trying to get Clojure and SLIME to work together.


Footnotes: 
¹ http://groups.google.com/group/clojure/msg/5f3df67b4e88b91c

-- 
Steven E. Harris





More information about the slime-devel mailing list