Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Syntax and reader by
closed by

Is the Clojure team interested in having someone enhance the reader so that the readtable is available to the user? This would allow users to create readtables, specify read macros and dispatching read macros, and install a readtable as the current one.

closed with the note: not planning to add this

3 Answers

+1 vote
by
selected by
 
Best answer

The reader is closed to extension (but open to extensible data via tagged literals). This was an intentional departure from languages like Common Lisp - see the Clojure history paper (search for "Reader Macros") - https://clojure.org/about/history

So, no, not interested in this change.

+1 vote
by

It's been done before. The underlying issue with why this isn't a goal is the underlying design philosophy. The general belief seems to be that reader macros are more trouble than they're worth, and that tagged literals provide a controlled way of opting in to messing with the reader, rather than wholesale replacement or introducing a large, non-obvious surface area to mess with language semantics.

Given the fact we have tools.analyzer, tools.reader, and instaparse, implementing new reader syntax on top of the language is perhaps ameliorated by libraries.

Personally, I've dipped pretty hard into the CL read table abuse (to bootstrap clojure for instance), and I'm less enamored with reader macros than I was when I first learned about them. Seems to be a non-issue with Clojure, and perhaps a novelty in CL except in instances where you're actually doing language research and want to hijack the reader to make it easier to bootstrap stuff. In the absolute sense, it's a flex to demonstrate the "power" of languages like CL that allow messing with the reader over Clojure, but in practice, it's really underwhelming IMO.

+1 vote
by

Thanks for your answers, folks.

...