unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acorallo@gnu.org, 66750@debbugs.gnu.org,
	monnier@iro.umontreal.ca, acm@muc.de, stefankangas@gmail.com
Subject: bug#66750: Unhelpful text in C-h v for variables with a lambda form as value
Date: Thu, 2 Nov 2023 11:52:45 +0000	[thread overview]
Message-ID: <ZUONjYAG93UCC6y7@ACM> (raw)
In-Reply-To: <837cn08o13.fsf@gnu.org>

Hello, Eli.

On Thu, Nov 02, 2023 at 12:09:28 +0200, Eli Zaretskii wrote:
> > Date: Thu, 2 Nov 2023 09:37:15 +0000
> > Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 66750@debbugs.gnu.org,
> >   acorallo@gnu.org, stefankangas@gmail.com, acm@muc.de
> > From: Alan Mackenzie <acm@muc.de>

> > What Stefan seems to be proposing does not accord with his previous
> > paragraph.  He is proposing an implementation which would preclude
> > extension to what he calls the "less common" cases - things like working
> > in edebug and interpreted code in general, amongst others.

> I'm not sure your conclusion above is correct.  But even if it is,
> whether we want such extensions should be the subject of a separate
> dedicated discussion, after implementing what caters to the important
> cases, if an implementation that caters to all of them is much more
> complicated (which seems to be the case here).  There's no reason to
> reject a much simpler implementation just because it doesn't support
> 110% of the cases.

Implementing the "simpler" version which blocks extensions would be
wasted effort if we decide we want those extensions.  In practice, what
is likely to happen is that the extensions would never be implemented.
Surely these are central questions which should be answered before
embarking on a restricted implementation.  (OK, I can see the irony
here.)

> > > Alan, we are in the engineering business, where designing for the most
> > > common case, before adjusting the design in small ways for less common
> > > cases, is one of the important principles.

> > Another principle is not closing off future options.

> That is secondary to the above.  Future options might require a
> complete re-implementation, so the fact that the current
> implementation doesn't support those future extensions is not
> necessarily a fatal flaw.  It is just one disadvantage, which should
> be weighed against its advantages.

Perhaps a less heated comparison of feature/named-lambdas's advantages
with its disadvantages would be beneficial, here.

> > We're at the stage where there's working code, which already works for
> > edebug, ERT backtraces, early-debug.el, and so on.  So why are we
> > debating abstract design principles?

> Because having a working code doesn't necessarily mean we should be
> happy about it.

Really?  Would you be happier if this code didn't work, or didn't exist?

> > > And this is the usual outcome of trying to solve _ALL_ cases from the
> > > get-go, by focusing on the fringe ones.  Premature optimization and
> > > all that.

> > I haven't focussed on fringe cases.  I've focussed on getting a uniform
> > implementation without special cases.

> The point I'm trying to make is that in your attempt to find an
> implementation that covers everything you entered the area of the
> proverbial diminishing returns, and the result is problematic in
> several aspects.  Your objections to alternative ideas seems to come
> from the argument that those ideas will fail to support some rare
> cases, but I consider rejection of ideas on these grounds as wrong and
> even invalid, because it sacrifices too much for too little.

What would we be sacrificing if we were to merge this feature?

> > It would be nice if people actually tried out the code in practice before
> > criticising.  So far, there's no indication anybody has done this.

> Why do we need to try the code before discussing its obvious
> implications on Emacs?  The issues that Stefan is raising are crystal
> clear from just reading the code.

One of the issues that Stefan raised was that the defining symbol in
"thousands" of closures resulting from a single command would be an
unacceptable "waste" of storage.  I don't think this would be the case.
This is something capable of measurement, something I would expect Stefan
to do to back up his case.

> > > Alan, I'd appreciate if you rethink your approach to the
> > > implementation with the above principles in mind.

> > I don't want to implement something which will only work most of the time
> > for the easy to implement cases, and which precludes extension to the
> > general case.  I'd welcome any suggestions for a mechanism which would be
> > capable of extension to the general case.

> Once again, such ideas are definitely welcome, but they are not an
> "over-my-dead-body" kind of requirement.

Such ideas haven't been forthcoming in the last day or two.

> > I think you've already decided not to merge feature/named-lambdas.  I'm
> > not surprised, but it's a shame.

> I didn't yet make any decision, because I still hope you will agree
> with at least some of the arguments.  Or at least agree to some kind
> of compromise, even if you keep your opinions.

I don't think Stefan is talking about a compromise.  He's talking about
discarding my changes entirely, and starting again from scratch, working
to design principles and with design goals I disagree with.  How is that
a compromise?

Or had you in mind something less drastic?

> > Debugging Emacs Lisp is frequently a horrible experience, with partial
> > error messages which don't tell you exactly where an error occurred,
> > don't tell you which primitive triggered an error, and frequently give
> > truncated backtraces, if any at all, due to unwise condition-cases, and
> > so on.

> I disagree with "frequently" and "horrible".  My experience is
> different, although I do sometimes need to be "creative" to catch some
> errors.  But the existing tools, including GDB (which you for some
> reason seem to reject completely AFAU) and even printf-debugging
> usually do the job for me.  So the current situation being described
> in such apocalyptic terms is not something I can agree with.

I use gdb, not as fluently as you do, but I use it.  But debugging Lisp
with gdb doesn't seem natural and isn't easy.  And yes, I've put printf
(literally printf) into C code quite a bit, too.

A couple of days ago I got the error message:

    emacs-lisp/eieio.el:55:2: Error: Wrong type argument: listp, :autoload-end

At the indicated file position there was just a `require' form.  So there
was no information about where the error happened, what detected the
error, or what function or what variable gave or had the value
:autoload-end.  It says little more than "there was an error".  This is
what I mean by "horrible".

In this case I was able to sort it out relatively quickly from examining
my recent changes, but that's not always the case.  This is typical of
the quality of error messages which Emacs produces, in my experience.
I'd like to improve this.

> > One of these things is having meaningless anonymous entries in
> > backtraces and C-h v, with no connection back to the source code.
> > feature/named-lambdas fixes this.

> Won't jumping to the exact source line where the error happened fix
> this better?

It would be a different solution to a slightly different problem.  Just
seeing a file name and location is less informative than seeing the
defining symbol, and forces the user to take action to get more
information.  But I'm looking at putting this facility into the code too,
after comments from Mattias (in July) and Stefan.

> If I have a single significant gripe against Emacs Lisp backtraces, it
> is that there's no way of jumping to the offending source line in each
> stack frame, something that is very natural to provide.

This would be more difficult to implement.  We currently have in Emacs no 
connection between our execution point and our source code, beyond the
symbols with position used in compilation.

> Anonymous lambdas come as a very distant second or third problem, at
> least IME.

They've been a problem for me, at least.  That's why I set about solving
it.  And being of a lower priority is no reason to reject an existing
fix.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2023-11-02 11:52 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZUONjYAG93UCC6y7@ACM \
    --to=acm@muc.de \
    --cc=66750@debbugs.gnu.org \
    --cc=acorallo@gnu.org \
    --cc=eliz@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).