From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Change in files.el
Date: Sat, 28 Jan 2017 19:11:12 +0200 [thread overview]
Message-ID: <83ziibxg7j.fsf@gnu.org> (raw)
In-Reply-To: <jwv37g3m9h8.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Sat, 28 Jan 2017 11:51:07 -0500)
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: emacs-devel@gnu.org
> Date: Sat, 28 Jan 2017 11:51:07 -0500
>
> >> > These sound minor to me (and the last two are also possible without
> >> > the requirement, AFAIU).
> >> Hmm... how do you get the last two without that requirement?
> > Are we still talking about a predicate, i.e. a function that returns
> > either t or nil? If so, I think the last two are so trivial that I
> > don't know where to begin answering your question.
>
> I don't see what the form of the return value changes to the problem.
The default behavior is just the value t or nil, so reproducing the
default behavior is trivial. E.g., in the case in point the default
behavior is to always ask the user about every buffer, i.e. the
default implementation simply always returns t.
> Regarding "More generally, so that you can slightly change its
> behavior without having to re-implement the default behavior by hand":
> - what code would you write which preserves the behavior except that it
> logs all calls to some global variable?
> - what code would you write which preserves the behavior except that it
> returns nil for one specific buffer?
Here, everything you write in a non-default implementation belongs to
the new functionality; the original functionality is a constant value
returned unconditionally, and it's trivial to write.
> Regarding "Also, so as to make sure that it is *possible* to reimplement
> the default behavior by hand": in my experience trying to change
> *-function to default to a non-nil value, it often happens that the
> preexisting default behavior *cannot* be implemented faithfully (or
> without a lot of extra gymnastic) because it relies on some local
> variable which is not passed as argument to the predicate.
Once again, the default behavior of a predicate is just t or nil, so I
don't think I understand what you ware talking about here.
> I see what you mean. Yes, the default behavior ends up moved into its
> own function. I'm surprised you feel so strongly about it, tho, because
> it never caused me such trouble.
>
> When debugging a specific execution, I'm usually doing it with Edebug,
Tye need to use a debugger instead of just reading the code is already
a huge annoyance, which tremendously slows down problem-solving, due
to the need to arrange for some reproduction recipe, and then step
through the code.
> And when just reading the code without any specific execution in
> mind, I typically don't look at the value of
> save-some-buffers-default-predicate at all since the code should
> work correctly regardless of that value
Debugging a problem does not necessarily need to consider all possible
values, it typically considers only one -- the one that causes the
problem you are debugging. So it matters a lot whether you can
understand what happens with that specific value, and indeed what _is_
that value, when the problem hits. In a vast majority of cases, you
only have the final result in the user report: an error message or
some incorrect output, and need to work your way back from that to the
conditions and the logic which failed. Each indirection is one more
obstacle in this analysis, and given enough of them the analysis
becomes practically impossible (unless you are already well familiar
with the code in question).
next prev parent reply other threads:[~2017-01-28 17:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-28 2:16 Change in files.el Richard Stallman
2017-01-28 2:46 ` Stefan Monnier
2017-01-28 9:10 ` Eli Zaretskii
2017-01-28 14:40 ` Stefan Monnier
2017-01-28 14:57 ` Eli Zaretskii
2017-01-28 15:31 ` Dmitry Gutov
2017-01-28 16:12 ` Eli Zaretskii
2017-01-28 15:40 ` Stefan Monnier
2017-01-28 16:08 ` Eli Zaretskii
2017-01-28 16:51 ` Stefan Monnier
2017-01-28 17:11 ` Eli Zaretskii [this message]
2017-01-28 17:22 ` Stefan Monnier
2017-01-28 17:30 ` Eli Zaretskii
2017-01-28 17:42 ` Stefan Monnier
2017-01-28 17:53 ` Eli Zaretskii
2017-01-29 18:59 ` John Wiegley
2017-01-30 3:57 ` Leo Liu
2017-01-30 15:58 ` John Wiegley
2017-01-31 4:19 ` Leo Liu
2017-01-31 14:01 ` John Wiegley
2017-01-31 14:46 ` Stefan Monnier
2017-01-31 16:21 ` Kaushal Modi
2017-01-31 18:40 ` Default value of variables named `*-function' [was: Change in files.el] Drew Adams
2017-02-01 8:35 ` Andreas Röhler
2017-01-28 18:41 ` Change in files.el Mark Oteiza
2017-01-28 19:37 ` Eli Zaretskii
2017-02-01 3:49 ` Mark Oteiza
2017-02-01 7:33 ` Clément Pit-Claudel
2017-02-01 12:56 ` Eli Zaretskii
2017-02-01 14:12 ` Kaushal Modi
2017-01-29 0:21 ` Richard Stallman
2017-02-04 9:18 ` Eli Zaretskii
2017-02-04 23:52 ` Richard Stallman
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=83ziibxg7j.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.