Subject: bug#67455: (Record source position, etc., in doc strings, and use this in *Help* and backtraces.)

From: Alan Mackenzie <[email-masked]>
Date: Wed, 27 Mar 2024 03:35:41 +0000

Hello, Stefan.

On Tue, Mar 26, 2024 at 16:42:28 -0400, Stefan Monnier wrote:
> > r-p-defined-s positions only lambdas and NAMEs defined by defun,
> > defmacro, defvar, .... (around 50 defining symbols).  r-p-s positions
> > every symbol apart from nil.  They have different purposes.  r-p-d-s
> > gets info for the doc strings, which requires SWPs only for some
> > symbols.  r-p-s is needed to get warning message locations.  Were r-p-s
> > used for the doc string position information, most of the symbols would
> > need to be stripped of their positions before the form could be used.
> > It is simpler and faster not to position them at all.

> In terms of code, I can't see why it'd be simpler: we already have the
> r-p-s function, ....

We also already have r-p-d-s.  Both functions (together with plain read)
have read0 as their core engine.  The enhancement to read0 to support
r-p-d-s was only moderate in size and not complicated to anybody who
understands finite state machines.

> .... and we already have a function to strip that info when we don't
> need it any more, so it would be less new code to write if we just
> used r-p-s, I think.

I think you're envisaging an extensive redesign where SWPs would not be
tightly and individually controlled as they are at the moment, but
instead would be created en masse and stripped en masse a bit later.

There seems to me to be little justification for this.  It would need
more code in byte-run.el, and would be slower, too.  It would take a lot
of work to implement and debug.  At the moment, some SWPs (to do with
"complicated" backquoted lambda forms) survive long term, meaning we
would need complicated Lisp code to protect these individually.  

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).