From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 66750@debbugs.gnu.org, Andrea Corallo <acorallo@gnu.org>,
Stefan Kangas <stefankangas@gmail.com>,
acm@muc.de
Subject: bug#66750: Unhelpful text in C-h v for variables with a lambda form as value
Date: Mon, 30 Oct 2023 09:44:54 +0000 [thread overview]
Message-ID: <ZT97FoeGcLe99Xh8@ACM> (raw)
In-Reply-To: <jwvpm0xm8iv.fsf-monnier+emacs@gnu.org>
Hello, Stefan.
On Sun, Oct 29, 2023 at 17:47:57 -0400, Stefan Monnier wrote:
> >> It seems to me, if you have one of the two, the other becomes much less
> >> important.
> > True, but still important nevertheless.
> Not in my opinion. We've lived with neither for the last 40 years and
> it hasn't been raised as a problem pretty much ever during those 40
> years, so anything that covers the 90% cases will be already borderline
> "overkill".
Debugging Emacs Lisp is, in my experience, a ghastly task - incomplete
error messages, incomplete backtraces (largely due to unneeded
condition-cases), inability to run a debugger on redisplay hooks, ....
This latest amendment of mine is one small element of making it less
ghastly.
> >> In the docstring.
> > But the docstring isn't in the lambda at the moment. There's merely a
> > pointer to it there, which is no good for backtraces - it's too fragile.
> Never had a problem with that.
Not yet. Putting complicated stuff into backtrace code is a bad idea -
look what happened when cl-print got put into debug-early.el. Bugs.
> > Dealing with backtraces is a stressful business.
> I think you're going to give more concrete details if you want to
> convince me of that.
Don't be silly. Any time there's a backtrace, somthing Has Gone Wrong
and Isn't Working. That's bound to raise stress levels.
> > Forcing a user to look somewhere else for pertinent information can
> > only increase that level of stress.
> Any concrete evidence to back this claim?
Of course not. Just as you've got no evidence to back up the contrary.
> >> grep -C1 '^(add-hook' **/*.el | grep '(lambda'
> >> begs to differ.
> > OK, good point!
> > Here, obviously, the hook symbol should become the defining symbol,
> So that when you look at the functions on SOMEHOOK wondering where they
> came from, they'll tell you "oh, I come from SOMEHOOK"?
> > though admittedly this isn't coded up, yet.
> Not sure it would be very useful either.
> >> >> Furthermore, that info is already available to the bytecompiler, so it's
> >> >> actually easier to keep that info.
> >> > How are you actually going to use this information? What are you going
> >> > to print in a backtrace, in particular in a batch mode backtrace where
> >> > things like buttons are not useful?
> >> FILE:LINE ?
> > That is anything but concise, in contrast to printing the defining
> > symbol in braces. I've just had a look at a bytecomp.elc, and the
> > filename in the docstring field is 67 characters long.
> Hmm... have you ever seen the FILE info we print in `C-h v`?
> Has it often reached 67 chars?
> Then why do you presume we'd be so stupid as to include the full
> absolute file name in there?
That falls outside the bounds of acceptable GNU mailing list language.
> > In anything short of a full screen Emacs window, this, together with
> > the name of the subr, is going to spill over onto the next line.
> Yes, if we try hard enough, we can fuck things up badly, of course.
So does that.
> > Besides which, you'd need to store all the pertinent information, the
> > filename + line + column in RAM, probably in the subr or the byte
> > coded function.
> I already told you where we'd store that info. Not in RAM.
So with all the extra complexity you want to add, you'll risk getting a
recursive error and recursive backtrace.
> >> That's the beauty of it: by storing the info inside the raw docstring,
> >> we get to reuse all the existing code that takes care of storing the
> >> docstring somewhere.
> > Making another non-obvious structure to compete with the (lexical)
> > parameter specs.
> Yes. Hopefully fixing that arglist thingy along the way.
> > As I keep on saying, a backtrace may not depend on reading files;
> Saying so doesn't make it true.
You haven't made any attempt to justify this, to my mind, questionable
design.
> >> Also, the "performance profile" of docstring matches our needs here:
> >> just like docstrings, we don't need FILE+LINE+COL info under normal use,
> >> it's only needed when developing/debugging, so we want to store it "out
> >> of line".
> > Disagree: anybody getting a backtrace, or looking up a variable with C-h
> > v needs this information, at the very least for including in a bug
> > report. ;-)
> IOW, you agree.
> > We cannot ignore it, push it down the road, and hope that somehow it
> > can be tacked on later.
> Of course we can, because we don't *have* to instrument it.
Which looks like you intend to strip it out, leaving interpreted code as
a special case without the instrumentation. I don't think that's a good
idea.
> No matter how hard we work at it, there will be cases where "the origin"
> of an anonymous function will be anything but obvious. Even if we can
> pinpoint the source code where the `lambda` itself is found, it may be
> of no use to the programmer trying to figure out where it really "comes
> from".
> So it'll always be a best effort, where we try and cover the important cases.
Which is a good deal better than the current state of affairs.
> >> [ And, yes, if we really want to, I think we can add the FILE+COL info
> >> to uncompiled lambdas: it would force us to read `.el` files "with
> >> sympos" (thus slower) but it shouldn't be hard. ]
> > Again, there must be no file reading when constructing a backtrace.
> I'm not talking about `read`ing when you try and display the lambda.
> I'm talking about `read`ing where you `load` the code that will evaluate
> that lambda.
You've been anything but clear in saying what you intend here. You've
talked about "in the doc string" without saying whether you meant in the
..elc file or in the loaded program, for example. That's a critical
difference.
> > I still believe that the defining symbol scheme is the most practical
> > way of conveying the needed extra information to the user.
> Obviously.
> > Otherwise I would have hacked something different. ;-)
> I don't think that's how it works, sadly.
What are you talking about with "that"?
Thus far, all you've done is disparage every design decision I've made
with this code, saying how you would have done it differently, without
giving any justification for why your way would be better. How am I
meant to react?
Thus far, you've given no sign that you've actually tried the code out,
or done anything else with it bar vaguely looking at a diff from master.
It would be nice if you were actually to evaluate this code.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2023-10-30 9:44 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 17:09 bug#66750: Unhelpful text in C-h v for variables with a lambda form as value Alan Mackenzie
2023-10-25 20:53 ` Andrea Corallo
2023-10-27 11:35 ` Alan Mackenzie
2023-10-28 9:27 ` Alan Mackenzie
2023-10-28 15:04 ` Stefan Kangas
2023-10-28 15:59 ` Alan Mackenzie
2023-10-28 16:26 ` Eli Zaretskii
2023-10-28 16:57 ` Alan Mackenzie
2023-10-28 17:17 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-28 18:17 ` Alan Mackenzie
2023-10-28 18:38 ` Eli Zaretskii
2023-10-28 18:59 ` Alan Mackenzie
2023-10-28 19:13 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-28 19:59 ` Alan Mackenzie
2023-10-29 4:14 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-29 11:25 ` Alan Mackenzie
2023-10-29 16:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-29 18:50 ` Alan Mackenzie
2023-10-29 21:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-30 9:44 ` Alan Mackenzie [this message]
2023-11-01 12:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-01 15:03 ` Alan Mackenzie
2023-11-01 18:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-01 20:30 ` Alan Mackenzie
2023-11-01 22:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-02 6:13 ` Eli Zaretskii
2023-11-02 9:37 ` Alan Mackenzie
2023-11-02 10:09 ` Eli Zaretskii
2023-11-02 11:52 ` Alan Mackenzie
2023-11-02 13:50 ` Eli Zaretskii
2023-11-02 15:55 ` Alan Mackenzie
2023-11-02 16:50 ` Eli Zaretskii
2023-11-02 17:12 ` Andrea Corallo
2023-11-02 21:44 ` Stefan Kangas
2023-11-02 22:24 ` Alan Mackenzie
2023-11-03 3:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-03 19:46 ` Alan Mackenzie
2023-11-03 22:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-04 15:31 ` Alan Mackenzie
2023-11-26 12:32 ` Alan Mackenzie
2023-11-27 17:23 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-25 12:03 ` Alan Mackenzie
2023-11-02 20:53 ` Stefan Kangas
2023-11-02 21:20 ` bug#66750: help-split-fundoc (was: bug#66750: Unhelpful text in C-h v for variables with a lambda form as value) Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZT97FoeGcLe99Xh8@ACM \
--to=acm@muc.de \
--cc=66750@debbugs.gnu.org \
--cc=acorallo@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.