unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
To: Joost Kremers <joostkremers@fastmail.fm>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Allow underscore in non-binding clauses of `if-let*` and friends
Date: Tue, 12 Nov 2024 21:13:14 +0100	[thread overview]
Message-ID: <7230689b-25ad-4c1e-9f7b-27e0f57fba72@vodafonemail.de> (raw)
In-Reply-To: <868qto4lr6.fsf@fastmail.fm>

On 2024-11-12  14:36, Joost Kremers wrote:

> We already use underscore to mean "ignore this variable" in several
> contexts, so this seems consistent. It also macro-expands to the same
> code as the one without underscore, so it's not less efficient.

Actually, in a recent master your snippet even expands to

  (let*
      ((s (and t (foo (some-computation))))
       (s (and s (bar (some-other-computation))))
       (baz (and s (y-or-n-p "Hi? "))))
    (if baz (message "yes")))

with (uninterned) symbols s being used in place of `_'.

Seems that Michael has already seen to that:

  commit e680827e814e155cf79175d87ff7c6ee3a08b69a
  Author: Michael Heerdegen <michael_heerdegen@web.de>
  Date:   Fri Feb 16 22:07:18 2024 +0100

    Don't warn about _ not left unused in if-let and alike
    
    The macro expansions did not leave a variable _ unused; this triggered
    an irritating compiler warning (bug#69108).
    
    * lisp/subr.el (internal--build-binding): Handle bindings of the form
    (_ EXPR) separately.

And I might consider using underscores instead of alignment ...




  parent reply	other threads:[~2024-11-12 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 13:36 Allow underscore in non-binding clauses of `if-let*` and friends Joost Kremers
2024-11-12 17:55 ` Alfred M. Szmidt
2024-11-13 11:03   ` Joost Kremers
2024-11-12 20:13 ` Jens Schmidt [this message]
2024-11-12 20:23   ` Joost Kremers
2024-11-13 10:22 ` Sean Whitton

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=7230689b-25ad-4c1e-9f7b-27e0f57fba72@vodafonemail.de \
    --to=jschmidt4gnu@vodafonemail.de \
    --cc=emacs-devel@gnu.org \
    --cc=joostkremers@fastmail.fm \
    /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).