From: Xiyue Deng <manphiz@gmail.com>
To: Sean Whitton <spwhitton@spwhitton.name>
Cc: 67669@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#67669: 29.1; Drop text suggesting using `and' to replace `if'
Date: Fri, 08 Dec 2023 14:41:52 -0800 [thread overview]
Message-ID: <87msuk8ggf.fsf@debian-hx90.lan> (raw)
In-Reply-To: <87il596kht.fsf@zephyr.silentflame.com> (Sean Whitton's message of "Fri, 08 Dec 2023 10:45:18 +0000")
Sean Whitton <spwhitton@spwhitton.name> writes:
> Hello,
>
> On Thu 07 Dec 2023 at 09:49am -08, Xiyue Deng wrote:
>
>> Agreed on the point of being educational, and of course in the end
>> coding style is mostly a matter of personal preference. However, I
>> would argue a bit that in such case we wouldn't need `if' or `when' at
>> all as both can be emulated by `and' and `or' if you are careful enough.
>> On the other hand, `if' and `when' should exist for a reason. I quite
>> like this suggestion[1] that `if' and `when' are used to guard side
>> effects, whereas `and' and `or' are used for pure functions.
>> Interestingly the current example you quoted changed from using `and'
>> (as in the old version I quoted) to `if' probably based on this
>> reasoning. Similarly I wouldn't suggest to replace `if' with `and' in
>> the original example around the text we are discussing:
>
> It's an old Lisp convention, not Emacs-specific, to use 'and' for return
> value and 'when' for side-effects, and not to use 'if' when there is no
> 'else' clause.
Ack. Thanks for the historical tip!
--
Xiyue Deng
prev parent reply other threads:[~2023-12-08 22:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 21:47 bug#67669: 29.1; Drop text suggesting using `and' to replace `if' Xiyue Deng
[not found] ` <handler.67669.B.170189926211616.ack@debbugs.gnu.org>
2023-12-06 22:08 ` Xiyue Deng
2023-12-07 6:28 ` Eli Zaretskii
2023-12-07 9:08 ` Xiyue Deng
2023-12-07 10:16 ` Eli Zaretskii
2023-12-07 17:49 ` Xiyue Deng
2023-12-07 17:56 ` Eli Zaretskii
2023-12-07 19:54 ` Xiyue Deng
2023-12-07 20:22 ` Eli Zaretskii
2023-12-07 20:37 ` Xiyue Deng
2023-12-07 21:29 ` Drew Adams
2023-12-08 9:11 ` Xiyue Deng
2023-12-08 6:25 ` Eli Zaretskii
2023-12-08 9:07 ` Xiyue Deng
2023-12-08 15:37 ` Drew Adams
2023-12-07 19:37 ` Drew Adams
2023-12-07 20:00 ` Xiyue Deng
2023-12-08 10:45 ` Sean Whitton
2023-12-08 22:41 ` Xiyue Deng [this message]
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=87msuk8ggf.fsf@debian-hx90.lan \
--to=manphiz@gmail.com \
--cc=67669@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=spwhitton@spwhitton.name \
/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).