Wow, Lisp Reader !!

"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]> Sat, 23 May 2026 14:40:23 -0700
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
Holy smokes… Common Lisp did such an amazing job with everything else, and especially CLOS. But now that I am old, I want to specialize the Lisp Reader for myself. I get really wearing not being able to enter DD:MM:SS for Right Ascensions and Declinations.

But gobsmack'ingly, the Common Lisp Reader is hugely resistant to customization. The HyperSpec hints that custom readers should be possible:

2.1.4 Character Syntax Types

The Lisp reader <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_l.htm#lisp_reader> constructs an object <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_o.htm#object> from the input text by interpreting each character <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#character> according to its syntax type <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_s.htm#syntax_type>. The Lisp reader <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_l.htm#lisp_reader> cannot accept as input everything that the Lisp printer <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_l.htm#lisp_printer> produces, and the Lisp reader <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_l.htm#lisp_reader> has features that are not used by the Lisp printer <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_l.htm#lisp_printer>. The Lisp reader <https://www.lispworks.com/documentation/HyperSpec/Body/26_glo_l.htm#lisp_reader> can be used as a lexical analyzer for a more general user-written parser.



And yet, there are no functions to allow interrogation of the Readtable for character syntax types corresponding to any particular character, except for those that are marked as macro characters.

Other, macro characters, like tic (apostrophe) #\’ should really only carry meaning at the leading edge of a symbol name. But it serves as a stopping delimiter in the Lisp Reader so that you cannot have symbol names like Thing and Thing’, without writing them as |Thing’|.

Interestingly, the colon character, #\:, which is used to separate package names from symbol names, is *NOT* shown as anything special in the HyperSpec. It is simply listed as a constituent character.

Maddeningly, LW chose to intercept this character with eager resolution, rather than allowing it to just become absorbed as a compound symbol token for later analysis. And there are no CL Hooks to be found that allows for alternate interpretations.

So I find it totally mystifying that this corner of Common Lisp should be so comparatively backwards.



[ I apologize if I come off too harsh. I cut my teeth on Forth, which has no restrictions, at the observatories many decades ago… ]