Subject: bug#62020: Lisp reader: dotted pair notation not working when initial elements are omitted

From: Federico Tedin <[email-masked]>
Date: Tue, 7 Mar 2023 18:24:32 +0100

> Federico, it would be very easy to change the reader into behaving that way and I'll do that if required, but before I or anyone else change code or docs, and above all much more important and interesting would be to hear exactly why it matters to you and how you were affected by this corner of the reader semantics.
> Could be it that you saw the manual passage, decided to try it out -- which is good, we want more people to do that -- and observed that Emacs and the manual didn't agree on that point?
> As far as I can tell while researching ahead of the previous changed, the documented (old) reader semantics was merely emergent behaviour of an under-constrained implementation, never a purposeful design for user convenience.
> No other Lisp (Common Lisp, Scheme etc) implementation known to me provides such a reader 'feature', and no evidence of any use of it was found at the time. This is why your report is of such interest: did it actually break existing code, and if so, how exactly?

Hey Mattias. The reason I found this is actually a bit funny. I am
working on re-implementing the Elisp interpreter (and other parts of
Emacs) in Go, as a hobby/learning/fun project. My initial
implementation of the reader was based on the old version of Emacs'
reader (i.e. with read0 and read1 calling each other). Recently I
decided to port over the changes made to the Emacs reader
(nonrecursive reader), and immediately after I finished, I ran my test
suite and realized that some cases were failing. All of them were
related to the trailing dot notation, specifically when the initial
elements were omitted. The project itself can be found here
(https://github.com/federicotdn/pimacs), the reader is in read.go and
the test cases in interpreter_test.go. I implemented a fix in my code
in order to still be able to read these expressions (though it's a bit
ugly at the moment).

I agree that using the (. x) notation is not really needed, I haven't
used it in any of my code myself. And specially if no other Lisp
implements it, it would make sense to consider its removal! Though I
am not sure how these types of changes are handled in Emacs.