From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.devel Subject: Allow underscore in non-binding clauses of `if-let*` and friends Date: Tue, 12 Nov 2024 14:36:29 +0100 Message-ID: <868qto4lr6.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33109"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.7; emacs 29.4 To: "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 12 14:37:52 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tAr5a-0008Qe-DX for ged-emacs-devel@m.gmane-mx.org; Tue, 12 Nov 2024 14:37:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAr4U-0006tn-PG; Tue, 12 Nov 2024 08:36:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAr4P-0006s6-IS for emacs-devel@gnu.org; Tue, 12 Nov 2024 08:36:38 -0500 Original-Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAr4M-0001MG-CG for emacs-devel@gnu.org; Tue, 12 Nov 2024 08:36:36 -0500 Original-Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id C43D211401CB for ; Tue, 12 Nov 2024 08:36:32 -0500 (EST) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Tue, 12 Nov 2024 08:36:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1731418592; x=1731504992; bh=fcWWX9dFK7qybnyfyZs6zqUBHRNHQ1Da CHI/Q236KiA=; b=Hhex3ENuyHoxGA/ZC0fcEaYm4boEX4aAmPc7Gs967keh9AL0 ZzEzmqqYBb/RsQyvxKrQgZeTwgajkMp+OvU3uTKpJb6LGZBoE8yJTMpRKXqh0ZzL qrP9yuTxR/qDoQYk5SQ1jzAvJBKo1NUETWen20mUzPkutP/+OcawoBj7yR7hxubD DhaFCJVChsoHeym4w3y5egy/H2D6rbCZC6ULi5xQnf0btkVQJd+2mkn2pqKG4Twj LVhnAgysF/zs4ubj4BerVfUu+kMNJ6484jHFRbfnDq9x0MtUQs01XlZ1ZAtxBwUj +zc6Qx+akW7EnO7bnFSXD9ZkXSDC/f+DdQiOXQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731418592; x= 1731504992; bh=fcWWX9dFK7qybnyfyZs6zqUBHRNHQ1DaCHI/Q236KiA=; b=c phlr2tBmRuJDKna7HcxMlBlSbivI49egbLrhvn4Y6Upf3bc8c2bvRT2Sz3hvjpHD YzYr5ls+arzc7E06qaItBn4GsUjY+BVCgJ7lU94mEsyiU33UqPjoFKRdoqTXCTZq Sg34JGu7LPm8HKVkx2rqFtFymciZ5IdOEMLMz1MdeLLsKHYZ65DV5Rzl3JG+1geR 82Z6CF4RlS9SwkvwfNa55SV1tDOeotS988OIquJj9joVY3A/v9uZDdxTI15GPTwu /8oYBZBhlPCCZnZP8PF7NQzZiPIUXBwZVJInAdWhoSTmukMoXKQfgKBToLoTCzbW QpHUjJMENINdYdpwt1aUg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeggdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufgfff fkgggtsehttdertddtredtnecuhfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhho ohhsthhkrhgvmhgvrhhssehfrghsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpe fhveffjefhgeeuffegiedvheehfeduheduffegtdejudejheevheffffekhfffkeenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkh hrvghmvghrshesfhgrshhtmhgrihhlrdhfmhdpnhgspghrtghpthhtohepuddpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepvghmrggtshdquggvvhgvlhesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 12 Nov 2024 08:36:31 -0500 (EST) Received-SPF: pass client-ip=202.12.124.148; envelope-from=joostkremers@fastmail.fm; helo=fout-b5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:325425 Archived-At: Hi all, My apologies for launching yet another thread on `if-let*` c.s., but this should be a small one and I didn't want it to get buried in one of the other threads... `if-let*` c.s. allow non-binding clauses in their VARLIST/SPEC argument. It was suggested in one of the other threads that aligning those with the VALUE-FORM of the binding clauses would help to distinguish them: ``` (if-let* (( (foo (some-computation))) ( (bar (some-other-computation))) (baz (y-or-n-p "Hi? "))) (message "yes")) ``` I'm sure I'm not the only one who finds this a bit jarring, though I agree that the "normal" formatting is difficult to read: ``` (if-let* (((foo (some-computation))) ((bar (some-other-computation))) (baz (y-or-n-p "Hi? "))) (message "yes")) ``` The reason being that you really need to count parentheses to see that `(foo (some-computation))` is *not* a binding form where `foo` is bound to the result of `(some computation)`. I don't like counting parentheses. Instead, one could use underscores: ``` (if-let* ((_ (foo (some-computation))) (_ (bar (some-other-computation))) (baz (y-or-n-p "Hi? "))) (message "yes")) ``` 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. The only problem AFAICT is that flycheck complains: "variable `_' not left unused". This, I assume, is due to the fact that in the expansion of this `if-let*`, `_' is indeed used: ``` (let* ((_ (and t (foo (some-computation)))) (_ (and _ ; <=== *used here* (bar (some-other-computation)))) (baz (and _ ; <=== *and here* (y-or-n-p "Hi? ")))) (if baz (message "yes"))) ``` WDYT? Would it be a good idea to officially support this and mention it in the manual? (Not necessarily recommending it, but at least mention it as an alternative option.) If yes, what would it take to shut up flymake in this case? (I have no idea how flymake works, so it'd be helpful if someone pointed me in the right direction.) TIA -- Joost Kremers Life has its moments