GNU bug report logs -
#67455
Record source position, etc., in doc strings, and use this in *Help* and backtraces.
Previous Next
Full log
Message #73 received at 67455 <at> debbugs.gnu.org (full text, mbox):
> When Lisp gets read for interpretation, defined symbols (e.g. folliowing
> defun or cl-defgneric) get positioned, as do lambdas.
I don't know what that means.
> When there are ,s or ,@s on the arg list or the doc string of the
> lambda, the lambda currently gets posified by the new code in
> backquote-process.
Are you talking about "lambda" as in "the symbol" or as in "a (lambda
...) expression". If it's "the symbol", then I can't see where a , or ,@
can appear. If the other, then if there's a , or ,@ in there it
presumably means we don't yet know whether it *will* be
a lambda-expression or just a list with a lambda symbol: at that point,
it's just data and we don't know if it will be used to build code.
> Without the new code, the "complicated" lambdas retain their
> positions, which cause errors in pdump, which doesn't (and shouldn't)
> handle SWPs.
So, IIUC, your "get positioned" above means you preserve/add (rather than
strip) the position info on some symbols, most notably those `lambda`s
which "you" predict will be used for code, and if your prediction is
wrong then those sympos end up escaping into the wild.
> You're right about my sketched approach not working if the programmer
> uses cons/list instead of `, ,, and ,@. (Thanks!) Maybe I can somehow
> wait until (cons 'lambda (cons args body)) has been evaluated in ME2,
> before posifying the lambda. And also take the change out of
> backquote-process.
Sounds about right. You'll lose information about the place where the
`lambda` symbol was found in the code, but it's hard to do much better
with what we have,
We could introduce a new `backquote-lisp-form` which works just like
backquote but which additionally asserts that what it builds will be
used as a Lisp form rather than as data.
BTW, we already have such a thing under the name "edebug-\`".
> With this idea, most of the new code would go into the (`(function ,(and
> f `(lambda ,_ . ,_))) ...) pcase arm of macrexp--expand-all, with
> possibly a new arm to catch and "neutralise" the remaining lambdas, which
> aren't functions.
Not sure what other lambdas you're thinking of.
Stefan
This bug report was last modified 1 year and 13 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.