GNU bug report logs - #76132
Clojure-style auto-gensyms for macros

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Tassilo Horn <tsdh@HIDDEN>; Keywords: patch; dated Fri, 7 Feb 2025 21:13:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 12 Feb 2025 14:19:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 12 09:19:49 2025
Received: from localhost ([127.0.0.1]:33449 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tiDaf-0000Xp-7E
	for submit <at> debbugs.gnu.org; Wed, 12 Feb 2025 09:19:49 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:37910)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1tiDac-0000XP-G3
 for 76132 <at> debbugs.gnu.org; Wed, 12 Feb 2025 09:19:47 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1tiDaW-0002nw-5o; Wed, 12 Feb 2025 09:19:40 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=zHsDzn6yAvKgrmHZBfTf9hfbyiWSk+OIowgSv4g3UB8=; b=BQxASCzX6hw09j/uUDrA
 6C8NK0T8Kitc7BlwOQjwfp3Ri32XJsFOe0yvFUfRQzQ7hmbv8MkepXQkG5EuDNJRWYL5jQuMYnUxS
 BO9G65stx6rDM28D6brAAfRmG5UCe46sH8m/c/+B46IPXm/hEpqi1+yw2+ZAQCuP7RmJIW9tVdALD
 ePForyF6g/itpMXb1CFCh+fN8oM4Jj2L+BqxHF8WD6T8zCdi8LvFIbsBk2FhSRB+2qv4y9UqsISEB
 Z5YqjI/mxXEh6J+BrbqXQr59CnJ2/jMvbeXP+cipOjpD++3ArbxNXL4g1ilLJWLPGkd/MrRhC3oVU
 f8jbhU5E0bFugQ==;
X-ME-Sender: <xms:8a2sZwYrpRshhzkaYTdyy_K8r-191ryMzpWP12CJ5ZQJF8z45zY5Dg>
 <xme:8a2sZ7bReE8DHw9tQJcGtVNrkKDvdDfSVRQliREHxxG3wOrop34_kErfz-J3OQzju
 mpX3rD5zmr15w>
X-ME-Received: <xmr:8a2sZ68mA4INv4JLoXXKtCsCjq4SuS-LdKBce3eASxrQlfR8PmJC6ImPEBBbJXoyXtDylm1sHKKqnmWBY1ET0GhnvIfLaOlb>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeggedutdcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt
 necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne
 cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh
 gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei
 jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih
 hlrdhfmhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
 ohepjeeiudefvdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehrmhhsse
 hgnhhurdhorhhgpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggr
 lhdrtggr
X-ME-Proxy: <xmx:8q2sZ6oeUOCdk_zj477xrjbY0YsaKxihTBsRPA0TSCzKFFz9iUdqcQ>
 <xmx:8q2sZ7qOpWo9cnTpa-9YdE44L3TR7AesAP_LVBE0e45-WggvgmuZcA>
 <xmx:8q2sZ4R9F4ehn8IbP3sofbA1XD_kJ5UXjFaWw6rVgRqgfVRF2T7PYA>
 <xmx:8q2sZ7qaEkDSL_V0rjYSfCtjYv-KMDsVtIn5Qh9QPnTUNXLAQ2r6Gg>
 <xmx:8q2sZw7KF_d1OfAMbWHsAYs7uBvzEL106droMuWJ3Mp_j8lPDmy45wnD>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <jwvy0yb6zi8.fsf-monnier+emacs@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
 <87ikpkmn5b.fsf@HIDDEN> <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
 <E1tiABJ-0002Xs-N4@HIDDEN> <87pljnzb6e.fsf@HIDDEN>
 <jwvy0yb6zi8.fsf-monnier+emacs@HIDDEN>
User-Agent: mu4e 1.12.8; emacs 31.0.50
Date: Wed, 12 Feb 2025 15:19:27 +0100
Message-ID: <87jz9vz1n4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org, Richard Stallman <rms@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Stefan Monnier <monnier@HIDDEN> writes:

>>   (equal (macroexpand '(cl-with-gensyms (x)
>>                          `(+ ,x ,x)))
>>          (macroexpand '(cl-with-gensyms (x)
>>                          `(+ ,x ,x))))
>>   ;;=> t
>
> That doesn't test what you think it does because
>
>     (macroexpand '(cl-with-gensyms (x) `(+ ,x ,x)))
>
> does not return any uninterned symbols.  It returns the code which
> *when executed* will generate a new uninterned symbol.  Try
>
>     (equal (eval (macroexpand '(cl-with-gensyms (x)
>                                  `(+ ,x ,x))))
>            (eval (macroexpand '(cl-with-gensyms (x)
>                                  `(+ ,x ,x)))))

Argh, indeed.

Thanks,
Tassilo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 12 Feb 2025 14:02:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 12 09:02:23 2025
Received: from localhost ([127.0.0.1]:33396 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tiDJn-00089a-J0
	for submit <at> debbugs.gnu.org; Wed, 12 Feb 2025 09:02:23 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:55320)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tiDJl-00089J-MK
 for 76132 <at> debbugs.gnu.org; Wed, 12 Feb 2025 09:02:21 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 25D33442245;
 Wed, 12 Feb 2025 09:02:16 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1739368935;
 bh=UE1gFmUmz9rv6RJe9qGw4y3Sfi0Dw0C6NyuoIuIWyPU=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=FTUEYpS+fwh3R3NZ3GR2ECydz1bFZop8LbPFEE/AvDrHByPx0XtJ0SIJZjvJSv9on
 M7RpIMP0+1Vk+Pk5U2jLhmx3JrthcJgkIj/15iKXvzjjm4esskOchRmsExrLDuviv+
 mR4ii0hnwvX0bwxchLlpeRlj3bN5iIyuJqTK0WGlJLGJr8NG0SgzIcK8EZF9Wy/YiK
 Nf2fs4S/7dRYRMxgdr4ZTw19Icd0DAB08D53pkH55x2KhrBbrN3qkQv6yI8Y2IKpxn
 8U7DAS6CNS5q9jy7iuvmOwiGsDHya2XF3sVbkemM0IFyas3+pW3dcdxKf0XDR57j9L
 lhAxSygbMm1fA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 46292441CB7;
 Wed, 12 Feb 2025 09:02:15 -0500 (EST)
Received: from pastel (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0F64B120371;
 Wed, 12 Feb 2025 09:02:15 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Tassilo Horn <tsdh@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <jwvy0yb6zi8.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Wed, 12 Feb 2025 08:55:51 -0500")
Message-ID: <jwvmser6z4w.fsf-monnier+emacs@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
 <87ikpkmn5b.fsf@HIDDEN> <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
 <E1tiABJ-0002Xs-N4@HIDDEN> <87pljnzb6e.fsf@HIDDEN>
 <jwvy0yb6zi8.fsf-monnier+emacs@HIDDEN>
Date: Wed, 12 Feb 2025 09:02:14 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.018 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org, Richard Stallman <rms@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> does not return any uninterned symbols.  It returns the code which *when
> executed* will generate a new uninterned symbol.  Try
>
>     (equal (eval (macroexpand '(cl-with-gensyms (x)
>                                  `(+ ,x ,x))))
>            (eval (macroexpand '(cl-with-gensyms (x)
>                                  `(+ ,x ,x)))))

Actually a more precise test would be:

    (let ((codegen (macroexpand-all '(cl-with-gensyms (x)
                                       `(+ ,x ,x)))))
      (equal (eval codegen t) (eval codegen t)))


- Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 12 Feb 2025 13:56:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 12 08:56:02 2025
Received: from localhost ([127.0.0.1]:33349 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tiDDe-0007oK-7U
	for submit <at> debbugs.gnu.org; Wed, 12 Feb 2025 08:56:02 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:23153)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tiDDb-0007no-B5
 for 76132 <at> debbugs.gnu.org; Wed, 12 Feb 2025 08:55:59 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 38AE88092A;
 Wed, 12 Feb 2025 08:55:53 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1739368552;
 bh=ib6RA0k9eXKRJrzxcQls1JfwFNeB9U81tloOr4oQigE=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=aWLqxsG2aa2tpfOeriukDrQL3wm8vZ8E9s0sIM68qtFR+ov86CSQRCnYFSGltb6dl
 9G5enFUEJg6czMocJudxUZ5QI/bsTUH2JTMPmpcYxb4EOv23UXeN99+DJHcgZj9WPM
 WLVukyHpr+7xLg86lRX9DFY1TIU7dddBQ2uzhA0ZwmNKCOC9zws3wGtrAV+7NLK+/h
 DH/xECNMN+q/+YXVV+qPyQC0JCv/hCRS4p3a3jKdEydfRaZrDi20YN0muWrK4nAJOY
 NjvNLsMtncFJzGXV6K8n7F+oymKKX0xfvwLfzrtw4CO/r7jiryS5YTb55AZNh1osLs
 pwEeqvy5MeKyg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7B23F80683;
 Wed, 12 Feb 2025 08:55:52 -0500 (EST)
Received: from pastel (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4E0CD1204F5;
 Wed, 12 Feb 2025 08:55:52 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Tassilo Horn <tsdh@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <87pljnzb6e.fsf@HIDDEN> (Tassilo Horn's message of "Wed, 12 Feb
 2025 11:53:29 +0100")
Message-ID: <jwvy0yb6zi8.fsf-monnier+emacs@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
 <87ikpkmn5b.fsf@HIDDEN> <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
 <E1tiABJ-0002Xs-N4@HIDDEN> <87pljnzb6e.fsf@HIDDEN>
Date: Wed, 12 Feb 2025 08:55:51 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.043 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org, Richard Stallman <rms@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>   (equal (macroexpand '(cl-with-gensyms (x)
>                          `(+ ,x ,x)))
>          (macroexpand '(cl-with-gensyms (x)
>                          `(+ ,x ,x))))
>   ;;=> t

That doesn't test what you think it does because

    (macroexpand '(cl-with-gensyms (x) `(+ ,x ,x)))

does not return any uninterned symbols.  It returns the code which *when
executed* will generate a new uninterned symbol.  Try

    (equal (eval (macroexpand '(cl-with-gensyms (x)
                                 `(+ ,x ,x))))
           (eval (macroexpand '(cl-with-gensyms (x)
                                 `(+ ,x ,x)))))


- Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 12 Feb 2025 10:53:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 12 05:53:47 2025
Received: from localhost ([127.0.0.1]:32887 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tiANG-00014Z-Qq
	for submit <at> debbugs.gnu.org; Wed, 12 Feb 2025 05:53:47 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:39780)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1tiAND-00014G-VG
 for 76132 <at> debbugs.gnu.org; Wed, 12 Feb 2025 05:53:45 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1tiAN7-0005St-SH; Wed, 12 Feb 2025 05:53:37 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=1/UqbkBUIlhMiNtPi1foQbRobvuxRrThEtsseejk/e0=; b=NUuDX+sMKLBzeWQwcPSL
 PLkSP1XAEiw8jlsjnLhSiB2Zu2HuiJDo0fFUXU+TJFd0V2yeuQ2fxIDy6mqkpQDhVR9J3jL4Yauyb
 q9jMafeOmihhiTIAajmC7Oct1ZE2G9/zBegibwiC2GKPaEOOCKLOtMzXh9hW7ylQWdPkLQHw5EFsS
 G4HaoswZkXhdDtrjwgOUpDxh35vwEjQ3jXmQyHtWWG7DqBCRpwNuVdcwMw1e1CnrwRYwYbGPvJNwv
 e3XkkbQK0nfnkXoofhdG1AiSapq5W3vtFJO6Pl58gH/giTtDb3u15y8qJ1Zwv5dSUqBEJFmfB61YM
 b6b1g+/luaRiIQ==;
X-ME-Sender: <xms:q32sZ1auJmapm6vpGZr_sRmd1BOAou-BsAZ_hf6oiasyA8gXIiZ4tg>
 <xme:q32sZ8aaV9LFNjGMIkzc3wfAPrJhYzj5XrvPH54q4r70UBsS4f4vl_DJ-IQuIzkjO
 fqdCeuT7iWMzQ>
X-ME-Received: <xmr:q32sZ38iQ55QaQiggaq_GcK0jlvI_ifFvbzw2GGHFuAlufkwfOPv7JENWO7uE3n7tfttG7UK0lRGUZNUDAjjkjMZHcDmyHga>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdegfeeilecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt
 necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne
 cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh
 gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei
 jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih
 hlrdhfmhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
 ohepjeeiudefvdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnh
 hivghrsehirhhordhumhhonhhtrhgvrghlrdgtrgdprhgtphhtthhopehrmhhssehgnhhu
 rdhorhhg
X-ME-Proxy: <xmx:q32sZzo2i-etKu7l83ajc8C5_eNeiBc5Ikn73eNiZhqvchzJO9VXHA>
 <xmx:q32sZwr3uS6T0GBtnd1KkqFewAiDOAMfFDJeIzJ7f_F_QxgtOcNQ6w>
 <xmx:q32sZ5THP-OQB_j8z5rXNsTE98z06BMxlZwV7_od3sm8I3sXLBQjTw>
 <xmx:q32sZ4qDhNZWMxK0L2TLCe6ZqMBvOTdO1npFdM7dKXxayNCxQkjb5A>
 <xmx:q32sZ57KglxCwlZI1ZxidpZRt42HjvKo-Z_RC9ol6bQyjpktIDc-it8->
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: Richard Stallman <rms@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <E1tiABJ-0002Xs-N4@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
 <87ikpkmn5b.fsf@HIDDEN> <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
 <E1tiABJ-0002Xs-N4@HIDDEN>
User-Agent: mu4e 1.12.8; emacs 31.0.50
Date: Wed, 12 Feb 2025 11:53:29 +0100
Message-ID: <87pljnzb6e.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Richard Stallman <rms@HIDDEN> writes:

Hi Richard,

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>       > (defmacro my-foo (exp)
>       >   (with-uninterned-symbols
>       >    `(let ((x$ 6))
>       >       (+ x$ ,exp))))
>
> with-uninterned-symbols does not seem to exist in my checkout.
> Is it new?  Proposed?

Yes, I've proposed it but as it stands, it's already declined. That's
totally acceptable for me given the details of eager macro expansion
Stefan M. explained to me.

> I can guess from the example what it does.  It is terribly un-Lispy.
> Let's use this syntax instead:
>
>    (with-uninterned-symbols (x)
>      `(let ((,x 6))
>         (+ ,x ,exp)))
>
> It adds just one list of variables to the overall syntactic complexity
> of the construct when used, and it adds nothing to the syntax of Lipp.
>
> We could use the name `with-gensyms', a shorter name.

That's already available, named cl-with-gensyms and defined in
cl-macs.el.  But truth to be told, that exhibits the very same problem
that my proposed macro also has, i.e., that

  (equal (macroexpand '(cl-with-gensyms (x)
                         `(+ ,x ,x)))
         (macroexpand '(cl-with-gensyms (x)
                         `(+ ,x ,x))))
  ;;=> t

meaning that every expansion uses the very same uninterned symbol x, not
one unique symbol x per expansion.  As Stefan explained, that can lead
to problems in certain (honestly quite uncommon) corner-cases.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 12 Feb 2025 10:42:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 12 05:42:15 2025
Received: from localhost ([127.0.0.1]:32867 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tiAC6-0000Yp-Ok
	for submit <at> debbugs.gnu.org; Wed, 12 Feb 2025 05:42:15 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:37980)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rms@HIDDEN>) id 1tiAC4-0000Yb-4g
 for 76132 <at> debbugs.gnu.org; Wed, 12 Feb 2025 05:42:13 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rms@HIDDEN>)
 id 1tiABx-00038P-Ej; Wed, 12 Feb 2025 05:42:06 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From:
 mime-version; bh=dWd6oPKdMnXyyo5pTo3ddu2pqQXc5Jyx1M55O+tW+yA=; b=hJLd5TTnCXg6
 S0JhtuXqVtDkEYHyXXmUREBrqgQEQ14V/W+RcMmtNl1rdNb/I5zbaxX+H/PUkJL3ouU61QibMdVxZ
 6qqyZvTgPPgUuyDJt1LlPe2pYphGAXCg/gRM9VXMJSj5T8UZ3Lab31lu1RjErkDkJLAGftXWDaxjR
 AKRvHF3tlR4WeNlhlD07dnG3KfHvI6D3oGNWTd0gvAmPwhio+iZhmF8sww7fWgG9SnJrUxIDsuWxe
 kezP/xukJiiJRv3oVhKxdK6ZdvwSJDpjpiqQHVMLrJxay0RlelhekJZn+X3sN6MPVpTdGyxSv5/6V
 jn5YYUPkI/JfQwAijO3TMQ==;
Received: from rms by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <rms@HIDDEN>)
 id 1tiABJ-0002Xs-N4; Wed, 12 Feb 2025 05:41:25 -0500
Content-Type: text/plain; charset=Utf-8
From: Richard Stallman <rms@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
 <87ikpkmn5b.fsf@HIDDEN> <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
Message-Id: <E1tiABJ-0002Xs-N4@HIDDEN>
Date: Wed, 12 Feb 2025 05:41:25 -0500
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org, tsdh@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: rms@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

      > (defmacro my-foo (exp)
      >   (with-uninterned-symbols
      >    `(let ((x$ 6))
      >       (+ x$ ,exp))))

with-uninterned-symbols does not seem to exist in my checkout.
Is it new?  Proposed?

I can guess from the example what it does.  It is terribly un-Lispy.
Let's use this syntax instead:

   (with-uninterned-symbols (x)
     `(let ((,x 6))
        (+ ,x ,exp)))

It adds just one list of variables to the overall syntactic complexity
of the construct when used, and it adds nothing to the syntax of Lipp.

We could use the name `with-gensyms', a shorter name.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 10 Feb 2025 14:21:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 10 09:21:15 2025
Received: from localhost ([127.0.0.1]:49764 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1thUex-0002Hi-ED
	for submit <at> debbugs.gnu.org; Mon, 10 Feb 2025 09:21:15 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41669)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1thUet-0002HQ-Ir
 for 76132 <at> debbugs.gnu.org; Mon, 10 Feb 2025 09:21:13 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B706B8078F;
 Mon, 10 Feb 2025 09:21:04 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1739197263;
 bh=RUg+mxBFqwXBG9FPwUmMy+EGkdpnbSJnXWBpbGLPR9U=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=PoB+tGbbNAY14MIH2aeCLF6zH+I2mqgbWqKMIVWtmtb95ajB8f4ISpISQx71YIorl
 WY74Mfo1zupMhkbt7zmETS8TuULYT0Tle5DBiHXOEBAdElc99oVrK3VsXK8faWcS0w
 vSDCREIoEMK2Lh8c5HsKsQhzY0AAjQlbFGKE912atXa+MwnX8y8e1qr24cZu4DXyET
 13iCIzU6NDVLh6HW02k9Xj5yk2RYj0OyuHHQKoTr9q1TtaSUx5oAM6MW+3vDeSE0uT
 HjA9CI0vZNQrvGt3xLAK/1RZlI8I8L/mun8eQNPV6YsvKM2fLkzfjPpwMeGpq7TjEB
 SOfsD2vwrOggA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E1A64800CB;
 Mon, 10 Feb 2025 09:21:03 -0500 (EST)
Received: from alfajor (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B94131203DA;
 Mon, 10 Feb 2025 09:21:03 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Tassilo Horn <tsdh@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <87y0yegsix.fsf@HIDDEN> (Tassilo Horn's message of "Mon, 10 Feb
 2025 08:36:54 +0100")
Message-ID: <jwvldudgarn.fsf-monnier+emacs@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
 <87ikpkmn5b.fsf@HIDDEN> <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
 <87y0yegsix.fsf@HIDDEN>
Date: Mon, 10 Feb 2025 09:21:03 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.044 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> [ Admittedly, this all depends on when `with-uninterned-symbols` is
>>   macro-expanded, but in most cases it will be macro-expanded once and
>>   for all when the macro is defined.  ]
> Well, my naive assumption about macro expansion is that it's done lazily
> from inside-out.

Interesting: that's impossible.
Think about a case like:

    (dolist (push pushes) (message "%S" `(pop ,push)))

how can the macro expander decide whether or not `(push pushes)` and
`(pop ,push)` are calls to macros `push` and `pop` without first
macro-expanding `dolist` and backquote?

Similarly, we can't compile the above code without first expanding all
the macros.

> And furthermore, why does
>
> (defmacro th/my-foo (exp)
>   (let ((x (make-symbol "x")))
>     `(let ((,x 6))
>        (+ ,x ,exp))))
>
> not exhibit the exactly same problem?

Because the above code says explicitly that `make-symbol` is called
every time a call to `th/my-foo` is expanded.  Whereas in your version,
the code says that `make-symbol` is called every time a call to
`with-uninterned-symbols` is expanded, but that can happen either when
we define `my-foo` or when "use" my-foo (depending on whether the
macroexpansion is done lazily or eagerly, and it can't be done lazily
if we compile the macro).

> Is there a way to fix my macro?

I don't think so, in general.  E.g. if you want to generate fresh new
uninterned symbols every time the code is executed, then you can't
compile something like

      (with-uninterned-symbols
        (let ((x$ 6))
          (+ x$ exp)))

since the name of the variable is not known until runtime (and will be
different each time).

I think to fix it, you have to fuse your macro with backquote, so users
would write

    (defmacro my-other-foo (exp)
      (uninterned-backquote
       (let ((x$ 6))
         (+ x$ ,exp))))

but of course you could still support the syntax

    (defmacro my-foo (exp)
      (with-uninterned-symbols
       `(let ((x$ 6))
          (+ x$ ,exp))))

and simply have `with-uninterned-symbols` check that its argument is of
the form `(...) and treat it as a use of `uninterned-backquote`.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 10 Feb 2025 07:37:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 10 02:37:33 2025
Received: from localhost ([127.0.0.1]:47860 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1thOMH-00022R-FD
	for submit <at> debbugs.gnu.org; Mon, 10 Feb 2025 02:37:33 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:45430)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1thOME-00022B-U3
 for 76132 <at> debbugs.gnu.org; Mon, 10 Feb 2025 02:37:31 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1thOM9-0003wF-2a; Mon, 10 Feb 2025 02:37:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=3dTk0jOMTaixicfJcmVczBzerUI7PgshYJ+3jD5R6wk=; b=neoFwXIM5NwD7FSAJygP
 y66DzLM89kqZENmIc5gez3u9W/CWfMcJkmth00BTswPupHMWrHAZGD4zvIMLheLJ4TCFILE4kfYGH
 op3QqTff32s6ooXjOTawN3oO+s21nFnACM21CRiqV/LuOlXs9RHmPX+IBELzb+dVDs5RVfP6A0TyA
 5dPPcEqzkUs/RY4qG4suxcfTpvkz+kKZZEkBMmO1aKkGLcmo1FyckobfZsJw4ZB6X2C7Sdr18YV8W
 MjgUGcjjvW2xJmWAtQdB/q5bLGu4KzvcjQX06OGnXv8OSh4WfimM8ScV4mmZv/f/JMVg2iHFxQXA9
 9FDiudCZbFdWxA==;
X-ME-Sender: <xms:mqypZ4QQUSfst9fDIcqEMxwoqaeLP47QQ04n1coEC6W44vXjm6SVIA>
 <xme:mqypZ1y8AIyRga1tsIWwNKF2DsLevgMLp7Kd7pB7BbQLDgG5N_j5YTpo8zaDT77xH
 tNSO1R5ZtlkAA>
X-ME-Received: <xmr:mqypZ10zu6lgbRTCUMIe7rxdB_eySaQOeA7YcqdQteUi9AuGIallIJDq7XBgQAk1as4MwvYTWDnmwwp309jlJulJTiRbbEpu>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefjeegkecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt
 necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne
 cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh
 gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei
 jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih
 hlrdhfmhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
 ohepjeeiudefvdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnh
 hivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-ME-Proxy: <xmx:mqypZ8DYebnFvzNwbNQ4yvp_tKZRa7a7wyl-W8ynZ9_NfWuwHk1h0g>
 <xmx:mqypZxiO4f4m30tUsouyGDKnpcHj1nFTFKUZFDQQwny6KQEsmDWbNg>
 <xmx:mqypZ4qsuXrAsEApRCrcuxWS1-zCKxxhDua8Ql0JlYwrrhcJJ2DF0w>
 <xmx:mqypZ0gE6D9UjixSun6NObd5N0kGbzzGS8K5D4bfj4oIAqC2gtTwxA>
 <xmx:mqypZ4RPsxRYqUQlfzWJk7Gq2_pXOBgensegEcPQv85gvNT21wf5J7l9>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
 <87ikpkmn5b.fsf@HIDDEN> <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
User-Agent: mu4e 1.12.8; emacs 31.0.50
Date: Mon, 10 Feb 2025 08:36:54 +0100
Message-ID: <87y0yegsix.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Stefan Monnier <monnier@HIDDEN> writes:

Hi Stefan,

>> Why?
>
> I'd ask the author of the code.

;-)

>> I would expect that it's one set of uninterned symbols per expansion.
>
> Try:
>
>     (defmacro my-foo (exp)
>       (with-uninterned-symbols
>        `(let ((x$ 6))
>           (+ x$ ,exp))))
>
> and then check (equal (macroexpand '(my-foo r)) (macroexpand '(my-foo r)))

That's shocking! :-|

> [ Admittedly, this all depends on when `with-uninterned-symbols` is
>   macro-expanded, but in most cases it will be macro-expanded once and
>   for all when the macro is defined.  ]

Well, my naive assumption about macro expansion is that it's done lazily
from inside-out.  In that case, I would assume the macro works as I
intended.  Also nesting should be no problem, because when the outer
with-uninterned-symbols is expanded, any inner with-uninterned-symbols
has already been expanded so its own xs $ have been replaced with #:xs.

I guess you are talking about eager macro expansion, right?  I have no
clue how that works and the docs don't tell either.  Does it mean the
macro is expanded once its defmacro form is reached and the resulting
code is just inserted at its usages?  But if that's the case, how are
the macro arguments injected in the code at the right places?

And furthermore, why does

(defmacro th/my-foo (exp)
  (let ((x (make-symbol "x")))
    `(let ((,x 6))
       (+ ,x ,exp))))

not exhibit the exactly same problem?  I guess it's because "the
machine" knows that every ,foo needs to be once-per-expansion, right?
Or maybe this dependency disables eager macro expansion for this macro
altoghether?

Is there a way to fix my macro?  Maybe to define it so that it would
result in something like

  (let-alist (collect-$-vars exp)
    ;; Now build a replacement for exp which uses ,.x accesses in place
    ;; of x$, e.g., this:
    `(let ((,.x 6))
       (+ ,.x ,exp)))

such that there's a "dependency" of the expansion to an expression
that's evaluated at expansion time which in turn depends on exp?

>> Oh, and obviously you made me curious about those weird corner cases.
>> Please elaborate! ;-)
>
> I wish I could.  I'm starting to wonder if I dreamed it.
> The best I could come up with is:
>
>     (defmacro my-countref-let (var form &rest body)
>       (with-uninterned-symbols
>        `(let ((x$ ,form)
>               (count$ 0))
>           (cl-symbol-macrolet ((,var (progn (cl-incf count$) x$)))
>             (unwind-protect
>                 (progn ,@body)
>               (message "%S ref'd %d times" ',var count$))))))
>
> where (my-countref-let v1 67 (my-countref-let v2 89 (+ v1 v2))) will
> say that `v2` was referenced twice and `v1` zero times (at least if
> that macro is byte-compiled).

Jesus Christ! ;-)

Bye,
Tassilo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 9 Feb 2025 23:35:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 18:35:10 2025
Received: from localhost ([127.0.0.1]:46880 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1thGpR-0006mu-UE
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 18:35:10 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:51002)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1thGpQ-0006ha-8z
 for 76132 <at> debbugs.gnu.org; Sun, 09 Feb 2025 18:35:08 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C8C28800CB;
 Sun,  9 Feb 2025 18:35:01 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1739144096;
 bh=uIqPtljE/Lp9WsVlHwnnLYgSrBVygX2Qd5OlP3ursF8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=GY+UTSczp16qfwBMxjxD9oV9M5UPPIHLggJohvfzEQCgqOahfOW18avh0PSbbPOJy
 3EmtTxgMSSVaMAhN3mBFG7W2BOXaer8VQl8rZZFRr7H94gcYD5X1BIN4vWkADRX1st
 n8UlmG0wiNSilwU3cRFpjLq0gBu16Teankdk6Bc0KDm+g6KlY4RJC6VegotdAUCyNC
 7DjW9m83WgArXhWtP9peUxo8QJMMnjS1+TNSBoP/TI7CF59jHJCghM0CEBA6Cis/6S
 uhz8jNDdiTskbSp+Tlf2mX8awBleLw+RuWnQkRagoMeI373mf0QqeHUNbHJLfH1/cQ
 pDW83/TlkimNQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BF493801B7;
 Sun,  9 Feb 2025 18:34:56 -0500 (EST)
Received: from alfajor (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9455712015E;
 Sun,  9 Feb 2025 18:34:56 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Tassilo Horn <tsdh@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <87ikpkmn5b.fsf@HIDDEN> (Tassilo Horn's message of "Sat, 08 Feb
 2025 17:12:00 +0100")
Message-ID: <jwv1pw6hgcb.fsf-monnier+emacs@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
 <87ikpkmn5b.fsf@HIDDEN>
Date: Sun, 09 Feb 2025 18:34:55 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.044 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Why?

I'd ask the author of the code.

> I would expect that it's one set of uninterned symbols per expansion.

Try:

    (defmacro my-foo (exp)
      (with-uninterned-symbols
       `(let ((x$ 6))
          (+ x$ ,exp))))

and then check (equal (macroexpand '(my-foo r)) (macroexpand '(my-foo r)))
[ Admittedly, this all depends on when `with-uninterned-symbols` is
  macro-expanded, but in most cases it will be macro-expanded once and
  for all when the macro is defined.  ]

> Doesn't that contradict your statement?

Apparently not.  =F0=9F=99=82

> Oh, and obviously you made me curious about those weird corner cases.
> Please elaborate! ;-)

I wish I could.  I'm starting to wonder if I dreamed it.
The best I could come up with is:

    (defmacro my-countref-let (var form &rest body)
      (with-uninterned-symbols
       `(let ((x$ ,form)
              (count$ 0))
          (cl-symbol-macrolet ((,var (progn (cl-incf count$) x$)))
            (unwind-protect
                (progn ,@body)
              (message "%S ref'd %d times" ',var count$))))))

where (my-countref-let v1 67 (my-countref-let v2 89 (+ v1 v2))) will say
that `v2` was referenced twice and `v1` zero times (at least if that
macro is byte-compiled).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 9 Feb 2025 12:51:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 07:51:50 2025
Received: from localhost ([127.0.0.1]:43520 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1th6ms-0003Lz-2Y
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 07:51:50 -0500
Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:53570)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1th6mo-0003Lg-LC
 for 76132 <at> debbugs.gnu.org; Sun, 09 Feb 2025 07:51:48 -0500
Received: by mail-ed1-x532.google.com with SMTP id
 4fb4d7f45d1cf-5de5a8a96abso2135720a12.3
 for <76132 <at> debbugs.gnu.org>; Sun, 09 Feb 2025 04:51:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1739105500; x=1739710300; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:mime-version:references:in-reply-to:from
 :from:to:cc:subject:date:message-id:reply-to;
 bh=wRSm1PCOzNf3LDq8EJSdQUQ38V84OSODTivMf2mdME8=;
 b=Vo+wCRSr/ExOWs0bpqaKDCcbj5yE1Rgw+jJ2MFRrFvufncHDBhNNSONZJq/8ognXTZ
 /IWxmjP82yNJ6TvSMNEpbHXs7mb5dCIoMV+OdaN6yOg3LM6hvH9XYky2GKegjUvM7UiV
 p+lU6Aw+71ifEBEjErNgNdeUObeo6Q7OYicgyYN1wHyleLTgkvail1LZJpBNar/IoSRB
 UQ3VS54znRLjnWUjl9ZOZt4I8uBiksTSv+FiasPROPxsiGZI2vrNUExLD2Bcu9JPvIWJ
 Z9Qf4SH7RkI9Akr5j9ZXZem8UxPUmm9MRTkgkPR3jky63ByLvqerRk5K75FgtMlNmzL6
 twhA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1739105500; x=1739710300;
 h=to:subject:message-id:date:mime-version:references:in-reply-to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=wRSm1PCOzNf3LDq8EJSdQUQ38V84OSODTivMf2mdME8=;
 b=wfMXNnmjnvo+XRkBW/wROyk9Z/g5/0LNPI7CKqZLG8JKy9cKUT/gO4GseN8P5Adi1N
 LNdkgVt9lDHx07KHyHYOGpp/ucoCEqa/waOePS0nnqYcA2XrFTRwiAR5/zd8Yi7bMX7P
 F4FiIP0656ZaXpJ1RwB/6G+291yVOG01ER1VMmFzXQr8FSFbkBXFTTDxFm1pHCpauQKp
 WK25K2Y6lEJO5Rn9Hzi0G+8YW10uwEjzsNcEafGWgk+t1sznMbkSARs6NWuaCNYLvQqu
 ms8sLvLzq3MgwLcBY0sn8CKcLvVO4IaX8WpjDY9FsxSVQnMoU+fbBvFU00gGIQxSVdF/
 7Qfg==
X-Forwarded-Encrypted: i=1;
 AJvYcCUKVrQSjLH5z1FB6S0XKfSw5G3J6j9j5jK7bUpKiiWI+WAJPvgEVOXFNqwqQFzr5MDMrZrWIw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwEBkB2G6iM5UGKno5KEQRjlhHDuO+aUDYmapriL08D19pp5Rkt
 uptvpkbWsbXBgDM3cF8bPetZNSiO9FRUAzmg2mISxCa9h0Va0UjuKuM4TwTrtrmxylE50i7ePvO
 5+/qHgBmvMmbxBSKk2hP4s7oOREo=
X-Gm-Gg: ASbGncu36kp49yHfvgK73Y8zG2JyprrzkAWY/FbIXpBuQ1qhn7hoxiTqpEPtg7YdzbF
 e7LF2Ybc01lQpGYkqsiNIo+XJBFnHsWXPjs1JryFcRgSOSmhAenTzHeSO/2tpVaq4b/z6ZnQo17
 o=
X-Google-Smtp-Source: AGHT+IH3jqnorutqr0mnlpYRTIM7Fa+L5cf2cem76qQB8s2BfJ5ngr6y85/04USzsNgdwqEjhGkgf29b6U+DXBOmdMM=
X-Received: by 2002:a05:6402:358f:b0:5dc:8f03:bb5b with SMTP id
 4fb4d7f45d1cf-5de44fe944emr24648633a12.5.1739105500102; Sun, 09 Feb 2025
 04:51:40 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 9 Feb 2025 07:51:39 -0500
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <878qqfxx79.fsf@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <86h65450rw.fsf@HIDDEN>
 <878qqfxx79.fsf@HIDDEN>
MIME-Version: 1.0
Date: Sun, 9 Feb 2025 07:51:39 -0500
X-Gm-Features: AWEUYZndqBZXIlRJyJgvXy5wrmwiuR_GuBgc8ljb8Z6BPbT5pFAF3yhT5GUkNN4
Message-ID: <CADwFkmk-bsTPzgHZX6X=mds+=2aXU3wOxhJgW_Kh4hY6wuN69w@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
To: Sean Whitton <spwhitton@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 Tassilo Horn <tsdh@HIDDEN>, 
 Stefan Monnier <monnier@HIDDEN>, 76132 <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76132
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Sean Whitton <spwhitton@HIDDEN> writes:

> On Sat 08 Feb 2025 at 09:54am +02, Eli Zaretskii wrote:
>
>> I'm very hesitant to extend the Emacs Lisp language with such
>> features, when this can be had for a price of a simple function call.
>> We have enough magic names and punctuation characters already, and
>> they get in the way of code readability.
>
> Yeah.  I think we should not add this for the similar reasons to how we
> don't have reader macros: Lisp is an almost syntax-free language, and
> there are advantages to that.
>
> Any step away from that cuts deeply into the advantages, and the
> corresonding benefits of the new syntax are often very minor.
>
> cl-with-gensyms is only slightly more typing, and is more trad Lisp
> style.

I'd tend to agree, FWIW.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 9 Feb 2025 09:51:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 04:51:53 2025
Received: from localhost ([127.0.0.1]:43178 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1th3yj-00007Q-8h
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 04:51:53 -0500
Received: from sendmail.purelymail.com ([34.202.193.197]:57892)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>)
 id 1th3yg-000079-8w
 for 76132 <at> debbugs.gnu.org; Sun, 09 Feb 2025 04:51:51 -0500
DKIM-Signature: a=rsa-sha256;
 b=gwtb2WQPD+fTqRS3JCYBMAdX5I1Y5KxorIrKaHeeO7vfuTy56HT2EUeqIgeNDWB4bp7aLOR7iynS1nAd8DdVodTwmceGhQIib6pL4z15nT4MaZwbQIwUNWpPQRQsAdvMHN5QMtsUY7Q5ioav9x7OsJU6HsdHlcih5PB4Vqt6WD0D0J4Ck6oWCglTGMIOxxfdUn0pET3ILMpQ0mSCeo94h9oPLVeCCQ/RXIW1VU3RMPWH3Wha3XDwOhJ9SNGiXpy0r8RT5YPKCro1+3BTS8WPELP+Xxj5cHLZAbFYoo9nwn1ZlKIhldYYyBGVUvO/rMmmUziHFAB846n7hDgxsaZpiA==;
 s=purelymail2; d=spwhitton.name; v=1;
 bh=O4jD8T/O1EtXIghFBsJY/mZ1zk74qoH5MUp4TYbHXDk=;
 h=Received:Received:From:To:Subject:Date; 
DKIM-Signature: a=rsa-sha256;
 b=UGQ79okZHHN3BA8LiAAK+lKLcbVHv4X4vSBgZjLv/Z5ASoNqDapPPJZGYMbGUXkBwG5AWw9X6XtK95sUKfViDZqChKey9n/v8aADGbBcXKsNehvE7ZQfPcQXMRo9/Z6059JNRqb8jRwiOMZAjKvW8pHVLjmQSnEuZyyPGDmIraT67f4AdTxIvAxlam3McZSkwY+XRc3LQ5kL4vZV+crJhUkXgv7gZ0F+drAjLdrGEH6W34YyjqCMbS0FVd4s/F+sJNKyibL5fdZXFEfDL3mnjb4QHq2++2wbnDSSz7I/hfbM3qneN9JuxiBQhH735G3VPa6qLHd+cCMRUAwGiBBF/A==;
 s=purelymail2; d=purelymail.com; v=1;
 bh=O4jD8T/O1EtXIghFBsJY/mZ1zk74qoH5MUp4TYbHXDk=;
 h=Feedback-ID:Received:Received:From:To:Subject:Date; 
Feedback-ID: 20115:3760:null:purelymail
X-Pm-Original-To: 76132 <at> debbugs.gnu.org
Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 641021296; 
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Sun, 09 Feb 2025 09:51:41 +0000 (UTC)
Received: by melete.silentflame.com (Postfix, from userid 1000)
 id 04CEE7E93DD; Sun,  9 Feb 2025 09:51:38 +0000 (GMT)
From: Sean Whitton <spwhitton@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, Tassilo Horn <tsdh@HIDDEN>,  Stefan
 Monnier <monnier@HIDDEN>,  76132 <at> debbugs.gnu.org
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <86h65450rw.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 08 Feb
 2025 09:54:59 +0200")
References: <871pw98no1.fsf@HIDDEN> <86h65450rw.fsf@HIDDEN>
Date: Sun, 09 Feb 2025 09:51:38 +0000
Message-ID: <878qqfxx79.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76132
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

On Sat 08 Feb 2025 at 09:54am +02, Eli Zaretskii wrote:

> I'm very hesitant to extend the Emacs Lisp language with such
> features, when this can be had for a price of a simple function call.
> We have enough magic names and punctuation characters already, and
> they get in the way of code readability.

Yeah.  I think we should not add this for the similar reasons to how we
don't have reader macros: Lisp is an almost syntax-free language, and
there are advantages to that.

Any step away from that cuts deeply into the advantages, and the
corresonding benefits of the new syntax are often very minor.

cl-with-gensyms is only slightly more typing, and is more trad Lisp
style.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 9 Feb 2025 09:22:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 04:22:26 2025
Received: from localhost ([127.0.0.1]:43114 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1th3WD-00076L-Se
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 04:22:26 -0500
Received: from mail-vk1-xa2c.google.com ([2607:f8b0:4864:20::a2c]:53551)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1th3WA-000760-F8
 for 76132 <at> debbugs.gnu.org; Sun, 09 Feb 2025 04:22:23 -0500
Received: by mail-vk1-xa2c.google.com with SMTP id
 71dfb90a1353d-5203d852d68so22653e0c.3
 for <76132 <at> debbugs.gnu.org>; Sun, 09 Feb 2025 01:22:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1739092936; x=1739697736; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=Ztyq4et44PotHPBIe6S3Kx3VFcAba0inq+vlRxMooiI=;
 b=mI6YY3lnq8BNhhzTiWM6Rcfg0hPw37kLkIytPeHmfrRC3CwlBONlQOhTAbLruBo5L4
 B/h8J8IutjHTlr0cpv1vemkVR+fGR03RCMpcw/lpdNOckgAF1RB4WNoZRbWG+9suGpPX
 1vziD+1DOzHKQ+VEJXmdiGdeH2Rh9NFH/Y1BPPxbri72kz+GbI8DDvqmxVteDAXiuWQs
 7HNNFvYqan46oYel6U9v82I4xM3gxXyoTn6ZvIR+a2kneNCJXModVkNuDApNZ9EEHqdJ
 RcJK/4z0ROwy0wadJwluzyfrRtoxb1an+YGT6pb1oAOIbDJj3l3R6LYDzRydxxL1sTSa
 Kdrw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1739092936; x=1739697736;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=Ztyq4et44PotHPBIe6S3Kx3VFcAba0inq+vlRxMooiI=;
 b=Nf/JTgOvV7NdBnBzXJD4FQ3927wH3STBJOBjRXB/2GWUq47trgLlhH0ZgT7DT+KWFX
 uc1s843Ty6C/HNbv8Wrh0VQclUlcxMTOKkgCiKqhfT45ztT720ULTyp6Xt3Qz/xNZiuH
 m1ehYSqAV9SQqcbMEAuOJZaeNMEavKbY/y43YPgdnfClL5F35KDmThbgo8J7kdVFwgwE
 VutuSWKeptyxKn8yaUaDdMe011dSkzoqlZxlM4nX6JQ7glx106klHi1z/MKx+mMwtjV2
 fh/qN0zlPyL0qxEC3fyGXfIoAtDvN1nPSG+dLfPEdn6XWAmrtOtZI5ME9SJINiWWHBl4
 lZWg==
X-Forwarded-Encrypted: i=1;
 AJvYcCV28NAfxtpjKIX1Oj0OOxTMl3z7f3lqCriPgL1E7nHlaxRoP72QjIeA1xgqoB7DvZOnxS4ung==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yz7TpmlNBy3GpX611uqHWgjlKnYh4pLBmF61zCGfrnslGJsl5eQ
 US3LA/VnfKSD7f8S78ZIKLqKHpAw6f6KU2Vdxe0bI2gxkmMKNbKzCNU9IchEf0rZDpY/tt7fGcq
 v6pSqct+tuNH4RzEkubXYL7FxoMc=
X-Gm-Gg: ASbGnctSKXgUDoOXKTBmebvOdSUA9kx0ExUoN53m6SCMRNBW7plnzQyQJbhMTHTGkRI
 4rENbUP9vHZoZiOoWqMkWe5cTh86PxNSlXiBiEXSJ7+32tRhtuIw39mpMQ+5Jbc2BLE+ojrQ1
X-Google-Smtp-Source: AGHT+IHDtdPK+IUWoSXMg5+/XE0/mPaYMGJkGFCNQFp470EAz0G9JFOveRVgtntVGiNQ8jQla/7UiNWWCR09u16/r1s=
X-Received: by 2002:a05:6122:2191:b0:51b:b750:8303 with SMTP id
 71dfb90a1353d-51f2e2d6a17mr6973315e0c.11.1739092936538; Sun, 09 Feb 2025
 01:22:16 -0800 (PST)
MIME-Version: 1.0
References: <871pw98no1.fsf@HIDDEN> <86h65450rw.fsf@HIDDEN>
 <87msewhmb3.fsf@HIDDEN>
 <CAN+1Hbpqw2H9gdqcfTYGN2u=1ZWmjHhsgderuXcjeLPBke7nUg@HIDDEN>
 <87ed07cybt.fsf@HIDDEN>
In-Reply-To: <87ed07cybt.fsf@HIDDEN>
From: Ship Mints <shipmints@HIDDEN>
Date: Sun, 9 Feb 2025 04:22:05 -0500
X-Gm-Features: AWEUYZnZrQfJfun6W1xhEino_RkflWcFl1du98mzhDzX_UHXTLAcr5sUiLmc_L8
Message-ID: <CAN+1Hbq4co_9fnqiUxYW3xnhG3WN0hzotBzNCdRLFP4VrcEjtQ@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
To: Tassilo Horn <tsdh@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000b6c0fe062db22057"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76132
Cc: Eli Zaretskii <eliz@HIDDEN>, 76132 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000b6c0fe062db22057
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Good point on _. A suffix works. ^ suggests the mnemonic "it comes from
above."

(defmacro sm/test (x y)
  (with-uninterned-symbols
   `(let ((foo^ ,x)
          (bar^ ,y))
      (list :args `(,foo^ . ,bar^)
            :add   (+ foo^ bar^)
            :sub   (- foo^ bar^)
            :mul   (* foo^ bar^)
            :div   (/ foo^ bar^)))))

On Sun, Feb 9, 2025 at 3:33=E2=80=AFAM Tassilo Horn <tsdh@HIDDEN> wrote:

> Ship Mints <shipmints@HIDDEN> writes:
>
> > I prefer a hat ^ prefix as it is easier to read, rather than a dollar
> > $ suffix which seems muddled to my eye.
>
> I don't mind what character to use (the macro could even take it as an
> argument) but I'd prefer using a suffix simply because there's already
> the special prefix _ indicating to the byte-compiler that this variable
> is not used intentionally.  You might want to use that capability when
> your macro expands to a function which needs to have a certain signature
> but your implementation doesn't use all arguments, for example.
>
> Bye,
> Tassilo
>

--000000000000b6c0fe062db22057
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">Good point on _. A suffix works. ^ suggests the mnemonic &quot;it comes =
from above.&quot;</div><div class=3D"gmail_default" style=3D"font-family:mo=
nospace"><br></div><div class=3D"gmail_default" style=3D"font-family:monosp=
ace">(defmacro sm/test (x y)<br>=C2=A0 (with-uninterned-symbols<br>=C2=A0 =
=C2=A0`(let ((foo^ ,x)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bar^ ,y))<br>=
=C2=A0 =C2=A0 =C2=A0 (list :args `(,foo^ . ,bar^)<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 :add =C2=A0 (+ foo^ bar^)<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 :sub =C2=A0 (- foo^ bar^)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 :mul =C2=A0 (* foo^ bar^)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 :div =C2=A0 (/ foo^ bar^)))))<br></div></div><br><div class=3D"g=
mail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On =
Sun, Feb 9, 2025 at 3:33=E2=80=AFAM Tassilo Horn &lt;<a href=3D"mailto:tsdh=
@gnu.org">tsdh@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D"gmail_q=
uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2=
04);padding-left:1ex">Ship Mints &lt;<a href=3D"mailto:shipmints@HIDDEN"=
 target=3D"_blank">shipmints@HIDDEN</a>&gt; writes:<br>
<br>
&gt; I prefer a hat ^ prefix as it is easier to read, rather than a dollar<=
br>
&gt; $ suffix which seems muddled to my eye.<br>
<br>
I don&#39;t mind what character to use (the macro could even take it as an<=
br>
argument) but I&#39;d prefer using a suffix simply because there&#39;s alre=
ady<br>
the special prefix _ indicating to the byte-compiler that this variable<br>
is not used intentionally.=C2=A0 You might want to use that capability when=
<br>
your macro expands to a function which needs to have a certain signature<br=
>
but your implementation doesn&#39;t use all arguments, for example.<br>
<br>
Bye,<br>
Tassilo<br>
</blockquote></div>

--000000000000b6c0fe062db22057--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 9 Feb 2025 08:33:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 03:33:10 2025
Received: from localhost ([127.0.0.1]:43002 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1th2kX-0004nG-OT
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 03:33:10 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:43042)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1th2kU-0004mr-Kk
 for 76132 <at> debbugs.gnu.org; Sun, 09 Feb 2025 03:33:08 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1th2kO-0001Es-PI; Sun, 09 Feb 2025 03:33:00 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=LUcbkETBqD2ltCnYSaE8DAoDENky3NGKelhPZX1eqkI=; b=IqSiEo5mlDA0r4q6AJQO
 OVr0r0u3UsQjKEaq/LAmAIMT218/uw9fgs5ie7KXBu5i/aOpdoBbri2X0NSV+GVnAhqwNnhMUPa2c
 2uNf+Pkh8gQOGNOCTT09awvZPw0clVrABetiTrPYFOkLsFL6tUK5yJQtscRB9oC+clt2eiDndT7Xg
 pHEqs71k22przYMVf/c0libR3SzJ4/rIqmXwq46MTBdH2UXpP793uA/M0FLx5F7hZegP/jriIhww4
 WWjFUCWhYMXRHYesqpPPeSQPYjypekK9KrblQw2XzxN/wDhHmbEikVvb4Rqnv7r8Y6RGamKLoTkc4
 EwGTAsl8nxeolA==;
X-ME-Sender: <xms:O2ioZ2xGC4ppmagZUowJ3IQ86uSDoNj6T9Hcj91acbWBvE-unPHrJg>
 <xme:O2ioZyQgmMPZ3HHtT-Guuq6XulM8kvRF0_ow3ZGFj093sqWSxG70dmm5MHVRlgs5r
 8TJFBQHNFypQA>
X-ME-Received: <xmr:O2ioZ4VfNsURFArObNZb4fvKgHsLyB3UvNP7A6qyW4l7wsg3XAzeU-lytkYybVLHlrY794oPQVL2JKpwtILSkmciv-Qt8GHu>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefgeeiiecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt
 necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne
 cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh
 gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei
 jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih
 hlrdhfmhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
 ohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggrpdhrtghpthhtohepje
 eiudefvdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegvlhhiiiesghhn
 uhdrohhrghdprhgtphhtthhopehshhhiphhmihhnthhssehgmhgrihhlrdgtohhm
X-ME-Proxy: <xmx:O2ioZ8iVd3tVtPi9b6u6-FgKv7uKczcpyGi5rJpFaAL5Zqw1TY_hNQ>
 <xmx:O2ioZ4A6IMOCLcN6r1CWbl14n_ccvtC_IRecneo-8V6aKKump-KyRA>
 <xmx:O2ioZ9KELniZuBBW6Dcwy7twmDVnN37pUl7DR6DcAnqTiZrtwd8Kdg>
 <xmx:O2ioZ_DKWPdvLEnKkzIohuq5B4xsREaf5bkel8d1ixY3VvObK0Di2Q>
 <xmx:O2ioZwzVElUsKonillP_bPYnDiop4_lhnQNpHFBxXHdXlH4N5E2Re_HF>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: Ship Mints <shipmints@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <CAN+1Hbpqw2H9gdqcfTYGN2u=1ZWmjHhsgderuXcjeLPBke7nUg@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <86h65450rw.fsf@HIDDEN>
 <87msewhmb3.fsf@HIDDEN>
 <CAN+1Hbpqw2H9gdqcfTYGN2u=1ZWmjHhsgderuXcjeLPBke7nUg@HIDDEN>
User-Agent: mu4e 1.12.8; emacs 31.0.50
Date: Sun, 09 Feb 2025 09:32:54 +0100
Message-ID: <87ed07cybt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: Eli Zaretskii <eliz@HIDDEN>, 76132 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ship Mints <shipmints@HIDDEN> writes:

> I prefer a hat ^ prefix as it is easier to read, rather than a dollar
> $ suffix which seems muddled to my eye.

I don't mind what character to use (the macro could even take it as an
argument) but I'd prefer using a suffix simply because there's already
the special prefix _ indicating to the byte-compiler that this variable
is not used intentionally.  You might want to use that capability when
your macro expands to a function which needs to have a certain signature
but your implementation doesn't use all arguments, for example.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 8 Feb 2025 16:13:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 08 11:13:07 2025
Received: from localhost ([127.0.0.1]:41123 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgnS7-00072p-4V
	for submit <at> debbugs.gnu.org; Sat, 08 Feb 2025 11:13:07 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:54514)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1tgnS3-00072H-Mw
 for 76132 <at> debbugs.gnu.org; Sat, 08 Feb 2025 11:13:04 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1tgnRx-00021e-1V; Sat, 08 Feb 2025 11:12:57 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=gBTgWYNKF8zyXDGJFoxXOGmoIwgeLHgkxU+DnnPPg34=; b=SEtcuu1WXlKQ+rnTQPpz
 gi7c4nwmA0go0+Ho4Age6np5UkJ8PodqtJBj2/EOlOuETaJyEdYRc/eSQo4zkqVnK60lui1Y3Kahp
 X1gI3adQbfOFLP95GyulYcIBp6tq2okVUO1EKr08o4B4aXsZpmbr8HbUa+fkbIG2S7qK19JF5DKHx
 wCIcpE2AoKGVHp7IBWGyNKzGT52Npr8nW0eoEdv5C3Qdnx5I2r/vCaA1aFD7WfBpplGURq534j9X3
 gaISBh1yH2Ujcukl5Gh2mZ9fj3sYB4OpVs294upHhqDTJ/n9kMaygjiODeVLrfsQdFZq9ix2g3dNQ
 W+SNJ5qSU0gnWw==;
X-ME-Sender: <xms:VIKnZ3SQO2AMh-gKY0KZoBGHh76nAqpsvfqzeA3xbg6gRr679gVxzA>
 <xme:VIKnZ4zVCoh3ndssbzSjldDWmPuYz-eDs3XzNkUPmVJYwJo7cJa22rgZFyliH_b60
 QsgQRGvauKliA>
X-ME-Received: <xmr:VIKnZ80M6eR6KPeKmKbrI-OVU9CWEBaxXQ_HF1QUOLrLvRM2-TcT0wXlodzPg5JC94V_l2uy62PbOpTshCVIrNM_u-eCWOhE>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvdeiiecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt
 necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne
 cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh
 gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei
 jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih
 hlrdhfmhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
 ohepjeeiudefvdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnh
 hivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-ME-Proxy: <xmx:VIKnZ3ANmrAF1Y5oS1ZMXgSLIUf4P09Pf0vJzHoiQnKEwrx7oN2rWg>
 <xmx:VIKnZwgdLlnS5OMVNnDQ6tr1G9DmHSFCAMth_suKdnH4rwHkwd7REA>
 <xmx:VIKnZ7oo_pqWapVKvhxmIbvU_Eie2BXDui8iCDwxQlxRtbGT-A4loQ>
 <xmx:VIKnZ7gE5KBzo7-zOXueyFjj_o38y5yz5sV6kERC9ZUIN-VNpX4VDw>
 <xmx:VIKnZzQfpE-Qe9YZ2nvEUUUPyQ4XJ3OlwX0zP8iuYpq3ZCF2THgbpfz3>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
User-Agent: mu4e 1.12.8; emacs 31.0.50
Date: Sat, 08 Feb 2025 17:12:00 +0100
Message-ID: <87ikpkmn5b.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Stefan Monnier <monnier@HIDDEN> writes:

>> Clojure has a very convenient feature to make that easy.  While you
>> can write such macros traditionally like
>>
>> (defmacro foo [x y]
>>   (let [xv (gensym "x")
>>         yv (gensym "y")]
>>     `(let [,xv ,x
>>            ,yv ,y]
>>        (do-stuff (* ,xv ,xv) (* ,yv ,yv)))))
>>
>> you can also write much more concise and convenient
>>
>> (defmacro foo [x y]
>>   `(let [xv# ,x
>>          yv# ,y]
>>      (do-stuff (* xv# xv#) (* yv# yv#))))
>
> IIUC the two versions above aren't quite equivalent.
> The Clojure version seems to behave similarly to the macro you
> propose, which behaves more like:
>
>     (let [xv (gensym "x")
>           yv (gensym "y")]
>       (defmacro foo [x y]
>         `(let [,xv ,x
>                ,yv ,y]
>            (do-stuff (* ,xv ,xv) (* ,yv ,yv)))))
>
> in the sense that the same uninterned symbols will be used for every
> expansion.  This is usually fine, but can still result in name capture
> in some weird corner cases (tho I must admit I can't even remember
> what those corner cases are).

Why? I would expect that it's one set of uninterned symbols per
expansion.  I first tried implementing it with an alist instead of a
hash-table and didn't think about the fact that my alist function arg is
just a pointer to the head of the list so that when popping back from a
recursive call where I pushed onto the list (that is, to its head), the
new entry got lost.  With that failing approach, every foo$ occurrence
was substituted with a separate (make-symbol "foo"), so although the
exansion looked correct, every #:foo in there was distinct from all
other #:foo-s.  Doesn't that contradict your statement?

Oh, and obviously you made me curious about those weird corner cases.
Please elaborate! ;-)

Bye,
Tassilo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 8 Feb 2025 15:29:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 08 10:29:21 2025
Received: from localhost ([127.0.0.1]:41065 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgmll-0001yH-6K
	for submit <at> debbugs.gnu.org; Sat, 08 Feb 2025 10:29:21 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44425)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tgmlh-0001xz-K5
 for 76132 <at> debbugs.gnu.org; Sat, 08 Feb 2025 10:29:19 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 95B31809E5;
 Sat,  8 Feb 2025 10:29:10 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1739028549;
 bh=CnypsmLxgxPjzpMNI17bzVAj5+BmWe1/YxadC0CZWzM=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=HKpxlAdSPkMkPj3rvLo0EReVkiwRuxGBFLBVzy0f3UDwyZ2r0+4pZjnWxSH5o9fXt
 9SdG2JW0ml4iaDwxD1QWyBgB1v5C/ewk26LbKVetHakrBXVCkXf+K88a2e+cqV4dqE
 Rra83LrWee7m53yzcji+VIjmwfbcILlZPC4WCksu3io03CKcrrOUURVKhpNnzconh4
 qFqC6Z5qYq/lDAzpbIiSio5+FJnojCpwZDFNYp0fzn4Fc50oM0pISEjOhhgem1F4yG
 lqgkq/lUQAIvutGRfBK8/UJbR+VXxOrb9loi6taYi/flOJHRoeYyGP1MxWKsXTzBde
 xRtcpwmjGpOXw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9C81480191;
 Sat,  8 Feb 2025 10:29:09 -0500 (EST)
Received: from pastel (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 370E7120480;
 Sat,  8 Feb 2025 10:29:09 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Tassilo Horn <tsdh@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <871pw98no1.fsf@HIDDEN> (Tassilo Horn's message of "Fri, 07 Feb
 2025 22:12:14 +0100")
Message-ID: <jwv7c60fows.fsf-monnier+emacs@HIDDEN>
References: <871pw98no1.fsf@HIDDEN>
Date: Sat, 08 Feb 2025 10:29:07 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.042 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Clojure has a very convenient feature to make that easy.  While you can
> write such macros traditionally like
>
> (defmacro foo [x y]
>   (let [xv (gensym "x")
>         yv (gensym "y")]
>     `(let [,xv ,x
>            ,yv ,y]
>        (do-stuff (* ,xv ,xv) (* ,yv ,yv)))))
>
> you can also write much more concise and convenient
>
> (defmacro foo [x y]
>   `(let [xv# ,x
>          yv# ,y]
>      (do-stuff (* xv# xv#) (* yv# yv#))))

IIUC the two versions above aren't quite equivalent.
The Clojure version seems to behave similarly to the macro you propose,
which behaves more like:

    (let [xv (gensym "x")
          yv (gensym "y")]
      (defmacro foo [x y]
        `(let [,xv ,x
               ,yv ,y]
           (do-stuff (* ,xv ,xv) (* ,yv ,yv)))))

in the sense that the same uninterned symbols will be used for every
expansion.  This is usually fine, but can still result in name capture
in some weird corner cases (tho I must admit I can't even remember what
those corner cases are).

> I'm very hesitant to extend the Emacs Lisp language with such
> features, when this can be had for a price of a simple function call.
> We have enough magic names and punctuation characters already, and
> they get in the way of code readability.

To the extent that it's all implemented within a normal macro
(i.e. doesn't touch things like the reader or the `macroexp.el` code),
I'm not too bothered.  It could even live in a separate package if we
don't want it in core.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 8 Feb 2025 13:02:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 08 08:02:38 2025
Received: from localhost ([127.0.0.1]:39106 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgkTl-0008Jt-KF
	for submit <at> debbugs.gnu.org; Sat, 08 Feb 2025 08:02:38 -0500
Received: from mail-ua1-x933.google.com ([2607:f8b0:4864:20::933]:59803)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1tgkTj-0008Je-Ge
 for 76132 <at> debbugs.gnu.org; Sat, 08 Feb 2025 08:02:36 -0500
Received: by mail-ua1-x933.google.com with SMTP id
 a1e0cc1a2514c-86714f41f5bso192584241.3
 for <76132 <at> debbugs.gnu.org>; Sat, 08 Feb 2025 05:02:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1739019750; x=1739624550; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=2Ad8/+CmB7QVzgaFtLBNoWE3fw/zoNWxkYS5M2sxT20=;
 b=fP3oWHkZkoJyXzUuJ6rvb15p5NfMe58chAo4fE0kBdSAsJvlhNETv9lcI9aUZDdWGe
 xtrHyKeR6kmJq3Hj6Es4EUpw1HQICqGFfW0gzmcAg4roH4qilP+cfY+EXQG7jlDDpCxE
 puzkc7QyXB/hrWSJsVs8ym0jOb/kNQjx8mpAhlnLY9oD/NNLahZA8DKneqYfqRYhRhwv
 Q9o6MGnuAQY+Zm0SnxyyNUXWju5c2QhtgEprzVLNx58fsgpIJVyP0HBMtE6bK+bijR8j
 hD4iU/tMfNR2+hg1r/US8+PeqG+Id7QoeygD6yS2Hp4jpwdstVeMF1+4IficEnDje2Mw
 wQ4A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1739019750; x=1739624550;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=2Ad8/+CmB7QVzgaFtLBNoWE3fw/zoNWxkYS5M2sxT20=;
 b=jgcEzVEHt13mrufXIJN8DaLMFnDIQDeSyxjPtMnQMv8PzPJNnnj5ASZuorIdplH38I
 648Hi34Um2EmkxiRrFbbCSbL9RpOaUTOxL4A7U0ZIlYK62iXboMsPWd95h39EB9Kn+b8
 3KnJB1AZAypQImPLfQYZ1S4WRSGbLIVsZuO8zKMc7Ec679aJKu+6AbDzj7QmgAsrtkhk
 ZKOtEdVe2IrK5oqJWtQllrOtPQ11SQim5TMEvDAOBumjtqgGP6hlDZ+3Zb/lgjo/1+o6
 tElPPRsMWUkAcoMILAskRsLcbTYLSx/BAs+GEafQHKEdySzQAbhdjS8jZU2Dv4bRCnvL
 5M7w==
X-Forwarded-Encrypted: i=1;
 AJvYcCXiqrYzRm28RzaWqevfEFzqd1a3L7iJau9zx2eduXcEjAVdHPxl7J7x437+Wd8Cm6u8XuCtew==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyXH2fKeHXp7rstxPTRHG2pAjTCPzMU2eJsA0udCqbvr2Px4TP8
 VgEvTSE0gJQGaPoQavfR8yN15IVUdOpeIy3KnuhC4qDI8D2swK8Lvn1LatWW0adWJLMVIhpcZ9/
 KZVSilXkD0wp5FtkRrVlMSuQIefg=
X-Gm-Gg: ASbGncuYdOKZg0lFAnsQ0fnfJKdcGV0EpIL4trlfC4iFEOeByg1/9Fh1rr6lPS6E58V
 ttaBBgv129HGWBf8q390pimBujk9RBAZBo2ViMlDWRam/MlLTgJj00nAK7qiU8dxMWUUklD/y
X-Google-Smtp-Source: AGHT+IHw4ekwub1BFe1ugLcLwC0aHB9Ez60tNUNg2N2quJKXnTF+VIgUj0lwtLgFTB8d3ozjO7qd+zHOI9If0Orz1xQ=
X-Received: by 2002:a05:6122:c99:b0:518:97c2:f21a with SMTP id
 71dfb90a1353d-51f2e2428f9mr5906674e0c.6.1739019749785; Sat, 08 Feb 2025
 05:02:29 -0800 (PST)
MIME-Version: 1.0
References: <871pw98no1.fsf@HIDDEN> <86h65450rw.fsf@HIDDEN>
 <87msewhmb3.fsf@HIDDEN>
In-Reply-To: <87msewhmb3.fsf@HIDDEN>
From: Ship Mints <shipmints@HIDDEN>
Date: Sat, 8 Feb 2025 08:02:18 -0500
X-Gm-Features: AWEUYZmw0K9JJOb7PZG88QhtKkD6Q6mf6BhZ0U5Qw483jrN2ohcFI6y1bwZA0AM
Message-ID: <CAN+1Hbpqw2H9gdqcfTYGN2u=1ZWmjHhsgderuXcjeLPBke7nUg@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
To: Tassilo Horn <tsdh@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000718458062da11671"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76132
Cc: Eli Zaretskii <eliz@HIDDEN>, 76132 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000718458062da11671
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I've seen many unhygienic macros (found the hard way) and written some
myself out of laziness. It's a nice idea to encourage safer lazy macro
writing.

I prefer a hat ^ prefix as it is easier to read, rather than a dollar $
suffix which seems muddled to my eye.

I found no evidence of symbols with a ^ prefix in the Emacs code base or in
the elpa packages I use so would risk less conflict than $ which I have
seen around. I'd highlight these hat-prefixed symbols in some nice new
font-lock face.

(defmacro sm/test (x y)
  (with-uninterned-symbols
   `(let ((^foo ,x)
          (^bar ,y))
      (list :args `(,^foo . ,^bar)
            :add   (+ ^foo ^bar)
            :sub   (- ^foo ^bar)
            :mul   (* ^foo ^bar)
            :div   (/ ^foo ^bar)))))

-Stephane

On Sat, Feb 8, 2025 at 3:30=E2=80=AFAM Tassilo Horn <tsdh@HIDDEN> wrote:

> Eli Zaretskii <eliz@HIDDEN> writes:
>
> >> Would there be interest in adding something like that to Elisp?
> >
> > I'm very hesitant to extend the Emacs Lisp language with such
> > features, when this can be had for a price of a simple function call.
> > We have enough magic names and punctuation characters already, and
> > they get in the way of code readability.
>
> In my opinion, readability is the key point of the feature.  With the
> regular "declare the locals you need to introduce beforehand and then
> splice them into the expansion" approach, the distinction between locals
> and spliced-in macro args gets lost.  With the suggested
> with-uninterned-symbols macro, it's clear that foo$ is a local defined
> in the expansion while ,foo is something from "the outside".
>
> I'm not booked on the $-suffix, though.  It's just easy to type, stands
> out a bit and usually isn't used in the wild.
>
> Bye,
> Tassilo
>
>
>
>

--000000000000718458062da11671
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac=
e">I&#39;ve seen many unhygienic macros (found the hard way) and written so=
me myself out of laziness. It&#39;s a nice idea to encourage safer lazy mac=
ro writing.</div><div class=3D"gmail_default" style=3D"font-family:monospac=
e"><br></div><div class=3D"gmail_default" style=3D"font-family:monospace">I=
 prefer a hat ^ prefix as it is easier to read, rather than a dollar $ suff=
ix which seems muddled to=C2=A0my eye.</div><div class=3D"gmail_default" st=
yle=3D"font-family:monospace"><br></div><div class=3D"gmail_default" style=
=3D"font-family:monospace">I found no evidence of symbols with a ^ prefix i=
n the Emacs code base or in the elpa packages I use so would risk less conf=
lict than $ which I have seen around. I&#39;d highlight these hat-prefixed=
=C2=A0symbols in some nice new font-lock face. </div><div class=3D"gmail_de=
fault" style=3D"font-family:monospace"><br></div><div class=3D"gmail_defaul=
t" style=3D"font-family:monospace">(defmacro sm/test (x y)<br>=C2=A0 (with-=
uninterned-symbols<br>=C2=A0 =C2=A0`(let ((^foo ,x)<br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 (^bar ,y))<br>=C2=A0 =C2=A0 =C2=A0 (list :args `(,^foo . ,^b=
ar)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :add =C2=A0 (+ ^foo ^bar)<=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :sub =C2=A0 (- ^foo ^bar)<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :mul =C2=A0 (* ^foo ^bar)<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :div =C2=A0 (/ ^foo ^bar)))))<br></d=
iv><div class=3D"gmail_default" style=3D"font-family:monospace"><br></div><=
div class=3D"gmail_default" style=3D"font-family:monospace">-Stephane</div>=
</div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr"=
 class=3D"gmail_attr">On Sat, Feb 8, 2025 at 3:30=E2=80=AFAM Tassilo Horn &=
lt;<a href=3D"mailto:tsdh@HIDDEN">tsdh@HIDDEN</a>&gt; wrote:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex">Eli Zaretskii &lt;<a href=3D=
"mailto:eliz@HIDDEN" target=3D"_blank">eliz@HIDDEN</a>&gt; writes:<br>
<br>
&gt;&gt; Would there be interest in adding something like that to Elisp?<br=
>
&gt;<br>
&gt; I&#39;m very hesitant to extend the Emacs Lisp language with such<br>
&gt; features, when this can be had for a price of a simple function call.<=
br>
&gt; We have enough magic names and punctuation characters already, and<br>
&gt; they get in the way of code readability.<br>
<br>
In my opinion, readability is the key point of the feature.=C2=A0 With the<=
br>
regular &quot;declare the locals you need to introduce beforehand and then<=
br>
splice them into the expansion&quot; approach, the distinction between loca=
ls<br>
and spliced-in macro args gets lost.=C2=A0 With the suggested<br>
with-uninterned-symbols macro, it&#39;s clear that foo$ is a local defined<=
br>
in the expansion while ,foo is something from &quot;the outside&quot;.<br>
<br>
I&#39;m not booked on the $-suffix, though.=C2=A0 It&#39;s just easy to typ=
e, stands<br>
out a bit and usually isn&#39;t used in the wild.<br>
<br>
Bye,<br>
Tassilo<br>
<br>
<br>
<br>
</blockquote></div>

--000000000000718458062da11671--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 8 Feb 2025 08:29:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 08 03:29:18 2025
Received: from localhost ([127.0.0.1]:38280 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tggDF-00084C-Pk
	for submit <at> debbugs.gnu.org; Sat, 08 Feb 2025 03:29:18 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:34084)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1tggDD-00083x-4p
 for 76132 <at> debbugs.gnu.org; Sat, 08 Feb 2025 03:29:16 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1tggD7-0004YM-7n; Sat, 08 Feb 2025 03:29:09 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=MiSIrO9g2oR31OW0cLp+rnj++3hdEDzWXvAqUpzGPkw=; b=XIRbmr31NNq4wDuRZWeF
 UfzRZdrItujk/z6A9SQ0JjJvULosZQ/JpX7xnh4x9UrKbmqkbHMOZ4L2LHtV+Dr0xTf4cHUkGuIHO
 DazCERTlKU4ZEsbxQB28sMJeyDFaKoNetZqFZDeKVbH63WBL4fZtxPvSjzr3GHOqMFH5Nd8R4hu7k
 VgI87kuOcsnf0SPgNKER2I9cMwskvJNHatKaJYsTE7PVcRh1l2TmkhoIWR+3pA5bNuog6BoPqQAPq
 x6F8dnI/KjS98/oj/BgWU4bHfUZz4M1BL/vGmwosYYihvhfb9tKHNOsLy2Z0GTH2/re9kLzhZmJPv
 jhGPVhVQfeSsJA==;
X-ME-Sender: <xms:0xWnZ9s3q9vsaZC8qPpeLGCRm-ldRtjKWr8pDlRo79_M0xWyCVp8yQ>
 <xme:0xWnZ2em7wvLri-_EqN09uCU0MC2xom6hkPAckghahTPGCxGM290Y1Ud3Cupcfbw3
 vF3EUwleA9gLQ>
X-ME-Received: <xmr:0xWnZwy83hTZsOBaUB63kHNUXUkuZUL9NAGq9R2CZ6erfgDDNMTj2oo1gMDMmO0WBw9p-TtbHdNyxLXlEaD9KoBEtsrYSjxG>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefudejudcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt
 necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne
 cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh
 gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei
 jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih
 hlrdhfmhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
 ohepjeeiudefvdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnh
 hivghrsehirhhordhumhhonhhtrhgvrghlrdgtrgdprhgtphhtthhopegvlhhiiiesghhn
 uhdrohhrgh
X-ME-Proxy: <xmx:0xWnZ0NFvAeWz2_OPGT9oZGudRoaFWhRo1GtcWPujsArnldTwhpWlA>
 <xmx:0xWnZ99za6FAu8HbI0KpVk42MYQK0bx-YHbRmxy6sm-GAGcJ8uM5fw>
 <xmx:0xWnZ0VMVfnNckV5Z8XX2pC37qaE8E0r1d8YZ-y31fWut8MO3bf3hw>
 <xmx:0xWnZ-cIEWSqj5T5KniUXmrXWhX1eNTJrRRe_HJDks_RzB4y6dB14A>
 <xmx:0xWnZzch5XjRmW7XVzGuHTz4GbBRQnucaIm4RDKl_LFzOfbf6ESqLILr>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <86h65450rw.fsf@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <86h65450rw.fsf@HIDDEN>
User-Agent: mu4e 1.12.8; emacs 31.0.50
Date: Sat, 08 Feb 2025 09:29:04 +0100
Message-ID: <87msewhmb3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Would there be interest in adding something like that to Elisp?
>
> I'm very hesitant to extend the Emacs Lisp language with such
> features, when this can be had for a price of a simple function call.
> We have enough magic names and punctuation characters already, and
> they get in the way of code readability.

In my opinion, readability is the key point of the feature.  With the
regular "declare the locals you need to introduce beforehand and then
splice them into the expansion" approach, the distinction between locals
and spliced-in macro args gets lost.  With the suggested
with-uninterned-symbols macro, it's clear that foo$ is a local defined
in the expansion while ,foo is something from "the outside".

I'm not booked on the $-suffix, though.  It's just easy to type, stands
out a bit and usually isn't used in the wild.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 8 Feb 2025 07:55:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 08 02:55:13 2025
Received: from localhost ([127.0.0.1]:38192 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgfgH-0006XH-A5
	for submit <at> debbugs.gnu.org; Sat, 08 Feb 2025 02:55:13 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:51672)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tgfgD-0006RU-GG
 for 76132 <at> debbugs.gnu.org; Sat, 08 Feb 2025 02:55:11 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tgfg7-0001bg-8v; Sat, 08 Feb 2025 02:55:03 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=AZh0vX2Hy5tn3sIzUDoE2kBPfjSAJPzLSEZA1ZkVEO0=; b=bw8fnw/nvEn/
 hjlMarmeWNGxDro86f/qWR7mYJ1fVmh+L/V3WOa1wLw1LF0qldt4eORZe3/5hFXv2VGHlWzaGYUcV
 jpc9didcDkQukoSjHeYI42aAb57b5fb84yrO9p/OOOrh4/jJoGJJlT97I4e3doDYA21QFptn19XmW
 4gEdeEmXicOUPL3YBumRLWVHn1DfGmEaQsMIqneR+0b5Gvjv9Xf0bFLSCVkIt8Ttkta1JfpekGFju
 KKPrZ9W9tdxK93jFY531mo2gj1SsHFQ6XAR6OEuMCQWLkzlU3DL42CRxiKzjxvZa2b8xYS6DopIYP
 LhdqKSm6eq+skcJ2mXOARw==;
Date: Sat, 08 Feb 2025 09:54:59 +0200
Message-Id: <86h65450rw.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Tassilo Horn <tsdh@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <871pw98no1.fsf@HIDDEN> (message from Tassilo Horn on Fri, 07
 Feb 2025 22:12:14 +0100)
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
References: <871pw98no1.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Tassilo Horn <tsdh@HIDDEN>
> Date: Fri, 07 Feb 2025 22:12:14 +0100
> 
> in a recent bug report the topic macro hygiene came up, i.e., that a
> macro which introduces local bindings in its expansion better uses
> uninterned symbols for those in order not to clash with code passed as
> macro arguments which are spliced into the expansion.
> 
> Clojure has a very convenient feature to make that easy.  While you can
> write such macros traditionally like
> 
> (defmacro foo [x y]
>   (let [xv (gensym "x")
>         yv (gensym "y")]
>     `(let [,xv ,x
>            ,yv ,y]
>        (do-stuff (* ,xv ,xv) (* ,yv ,yv)))))
> 
> you can also write much more concise and convenient
> 
> (defmacro foo [x y]
>   `(let [xv# ,x
>          yv# ,y]
>      (do-stuff (* xv# xv#) (* yv# yv#))))
> 
> where each symbol ending in # will be replaced by a unique gensymed
> symbol (per name).  The expansion of the two macros is the same.
> 
> Would there be interest in adding something like that to Elisp?

I'm very hesitant to extend the Emacs Lisp language with such
features, when this can be had for a price of a simple function call.
We have enough magic names and punctuation characters already, and
they get in the way of code readability.

Stefan, WDYT?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 8 Feb 2025 07:16:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 08 02:16:10 2025
Received: from localhost ([127.0.0.1]:38111 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgf4T-0004Z3-OQ
	for submit <at> debbugs.gnu.org; Sat, 08 Feb 2025 02:16:10 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:56890)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1tgf4Q-0004YW-J7
 for 76132 <at> debbugs.gnu.org; Sat, 08 Feb 2025 02:16:07 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1tgf4J-0005Dp-KB; Sat, 08 Feb 2025 02:15:59 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=G+/C23wQip+6AUZTkmnosj9qx72G1PCx/OnjXz2fZWI=; b=XZVofTB1oGMHMOZc7ZLt
 KuikXQcXSu10gKwxVI/x7Md9SueFjZJtwPrK96komtolculsI5qPPOKFgHMgsx61t+/ZCXS6EoHw8
 qD5GzG+KCV69zq3I2kekP9/RtGEMvTgIHBxE6QkwYzD1ERNgdWD9DlT5vge5H+D0JSb/mhR+A0CEm
 l8rmkmwKZdse9o0tXMCOgXvAeVrBmfppUKO+0vq58tnAoRioEWtTA/b+OVQRj2/PpoaRKTyBuh1x9
 YPhXuSRmavxdOO+6Q0obf3aYanITe5T/OU/fp2DAIsKvQofX48+HVoqLOhTgDMdpXb+OQOTuTTCgK
 1Svh1CgXEfYF3Q==;
X-ME-Sender: <xms:rgSnZ5icZqgfTndhTgYxnyVO1e6UHmCYF2uKgYGu6m_jdPnSkZvcUQ>
 <xme:rgSnZ-BYd1hfAPf1uFkvxkiGVRPra67auIJg06RqKYwEWAbQHBhDp7N_rqBHlMu9h
 1iWG4bGYE-ZmA>
X-ME-Received: <xmr:rgSnZ5Fvigo08PRfqVV8bVPI8SQoLZzPLG67iDXCrS-I8ruwH0Utp9BukeetsQDvXgtgJP3fHYwGPEZ2dR2RbR_Sa141meRm>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefudehjecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt
 necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne
 cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh
 gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei
 jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih
 hlrdhfmhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
 ohepjeeiudefvdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehthhhivg
 hvohhlsehpohhsthgvohdrnhgvth
X-ME-Proxy: <xmx:rgSnZ-QyvbnDM8tue5tkDjkkZA90WMu0o-0JtAMN8fEO9RqY3HnC8Q>
 <xmx:rgSnZ2xHu-8I1rp-66eGspvi_27GRBT5CfTdMXC601vn1XCpdK6yDA>
 <xmx:rgSnZ04NX1W4WJtv-ImxZaOkwX1oI9YXgXphym8U3v_CvnqcHu-SDg>
 <xmx:rgSnZ7xP8hlXhx-dsQonMhr2u7pSB8YYIQq_C6ZEDtuFULAvUqbvqw>
 <xmx:rgSnZ-inz1G0losyuFcf_Als7Xbo_7LsDop5hxQPbcNPkrNOwEw0xQjV>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: Thierry Volpiatto <thievol@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <87msexjete.fsf@HIDDEN>
References: <871pw98no1.fsf@HIDDEN> <87msexjete.fsf@HIDDEN>
User-Agent: mu4e 1.12.8; emacs 31.0.50
Date: Sat, 08 Feb 2025 08:15:55 +0100
Message-ID: <87ikpkhpp0.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Thierry Volpiatto <thievol@HIDDEN> writes:

Hi Thierry,

>> you can also write much more concise and convenient
>>
>> (defmacro foo [x y]
>>   `(let [xv# ,x
>>          yv# ,y]
>>      (do-stuff (* xv# xv#) (* yv# yv#))))
>
> Don't we have cl-with-gensyms which is very convenient as well?

Ah, I didn't know.  Well, cl-with-gensyms is basically just a let which
binds the given names to new gensyms.  Then you have to use them as you
did before, e.g., splice them in the expansion `(... ,v1 ,v2).  My
variant infers and replaces the symbols itself by a naming convention
("ending with $" in my example file).

Bye,
Tassilo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 8 Feb 2025 07:08:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 08 02:08:00 2025
Received: from localhost ([127.0.0.1]:38089 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgewa-00047n-5x
	for submit <at> debbugs.gnu.org; Sat, 08 Feb 2025 02:08:00 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:56700)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1tgewX-00047Q-09
 for 76132 <at> debbugs.gnu.org; Sat, 08 Feb 2025 02:07:58 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>)
 id 1tgewR-0003fn-DA; Sat, 08 Feb 2025 02:07:51 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=MDWBbeEui74fNMAMWvCY5pGujO1KIRDk9zAfkW6R6Eg=; b=HHw+tD5W9RRC/Bv6Acuy
 vUhX4jJd11kJ7KQFB+4tGMK2V8Ij6O/B9mnbz1xtuq+IwJMnkbcgC69AtsmKhrD2ca7m7jiw7Qylk
 GS3lyNNcfotByoz2L/XnhzPlQxjDnDSdvnUB4bz+ctJmKhcO5k6n4yG5a2usV+gPzyNKJ6OzLLZDd
 h24MVJYwoC3Bh53jiSakuuW7V47267f/HS93tGQg8+N5y5xjvWnvzUuU4la7LzQMdYS7zsJL1FiOh
 aPu/PSF4URNnhq2fWM+0GmNwgCuJqNy3IcEwaGTbx2nBrBIPfGA2mk0Bn2MSpR9J+fV3FQhUBchN6
 N7P4w4OokX0iLA==;
X-ME-Sender: <xms:xgKnZ1YaCfbFacAQVn8-6lUq9iVVG7YThZ4Kd43sR8ct6X1vfktb_w>
 <xme:xgKnZ8aWxxI_BRHjbp2sj9B1k7iA72AvbMzQsKtIejONAnvMaH00u5dRt07gSVWHU
 erw4C_fZnhd5A>
X-ME-Received: <xmr:xgKnZ39uWfqx-a-gBqswpuXGABy5EZX9_lH0ogvj4PlOIB8UjAiERO7TbS3TSgefWMIo8_qmOmA5stjmXo2lTBhMC5yqBpbb>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefudehhecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt
 necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne
 cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh
 gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh
 hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei
 jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih
 hlrdhfmhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthht
 ohepjeeiudefvdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegurhgvfi
 drrggurghmshesohhrrggtlhgvrdgtohhm
X-ME-Proxy: <xmx:xgKnZzqSUTWjYYjf6X131a-bhv-zFxtxkUQAhsOJtsOt73l28_R2HA>
 <xmx:xgKnZwoj11K9oY0FI_K8tnXDk-Jn3gaTLkDQYJgkgCjMzlvjqADXbQ>
 <xmx:xgKnZ5SDMwn1Q3XpXkSnVxBWjC6shYO_WA_ommuO4DOmnPiInibY6Q>
 <xmx:xgKnZ4qPM0oHsqjfBkvaiB8wGxOhjsK67AIQZmAqfEMxeLLmN_7R_Q>
 <xmx:xgKnZ57m0vKcmB6eusz0WyL66GpFA2XaRI45PL_JNnAfGsC8ZQOcJo3k>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: [External] : bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <DS7PR10MB523282B0BEF50BD59FD01B3EF3F12@HIDDEN>
References: <871pw98no1.fsf@HIDDEN>
 <DS7PR10MB523282B0BEF50BD59FD01B3EF3F12@HIDDEN>
User-Agent: mu4e 1.12.8; emacs 31.0.50
Date: Sat, 08 Feb 2025 08:07:46 +0100
Message-ID: <87o6zchq2l.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: "76132 <at> debbugs.gnu.org" <76132 <at> debbugs.gnu.org>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Drew Adams <drew.adams@HIDDEN> writes:

>> (defmacro foo [x y]
>>   `(let [xv# ,x
>>          yv# ,y]
>>      (do-stuff (* xv# xv#) (* yv# yv#))))
>> 
>> where each symbol ending in # will be replaced
>> by a unique gensymed symbol (per name).
>> Would there be interest in adding something
>> like that to Elisp?
>
> So you could no longer let-bind a variable
> whose name ends in `#', to get a normal let
> binding?  (Admittedly, you need to write that
> as `\#' in the source code.)

No, have you looked at the file I attached?  You will see the feature is
implemented by a macro itself, so if you don't like it, don't use it.

> Doesn't sound like an improvement, to me.
> A priori, I'm not in favor of limiting the
> names you can use for variables.
>
> That would be especially pernicious with let
> bindings of dynamic ("special") variables.

How many special variables are there ending in # (or actually $ which I
use in my example)?

Bye,
Tassilo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 8 Feb 2025 03:28:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 07 22:28:18 2025
Received: from localhost ([127.0.0.1]:37672 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgbVx-00072t-RY
	for submit <at> debbugs.gnu.org; Fri, 07 Feb 2025 22:28:18 -0500
Received: from mout02.posteo.de ([185.67.36.66]:36511)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <thievol@HIDDEN>)
 id 1tgbVt-00072X-Mr
 for 76132 <at> debbugs.gnu.org; Fri, 07 Feb 2025 22:28:15 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id E4D91240101
 for <76132 <at> debbugs.gnu.org>; Sat,  8 Feb 2025 04:28:06 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1738985286; bh=ZP39dtWO2ew5ulI/NQPXW2uQ1sAhw5oNDT9qYSl20R8=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 Autocrypt:OpenPGP:From;
 b=A9C13aaIUNyEPNeMVVKepReZAWJGBRWhcpIaxOOnoPUz+kNI0B+M9m1o1r+bYmgtK
 bFwaFGHTqR+2GSx8HNqZNOG+FofjIvGspBZ70IshyaBLQGgK694eOTUBYdP40un0Xk
 ytglcblaO5JF+2mhT0fumpvBDu5d+tfG4lFvKGDkPZh68lxVU7AyK8sju4kXfCILup
 AILznylnJ1QmmF/VkW7cXcKVvMkPZfLd4xRnDbMjv1fIFHaKzRa8RdLU4VsUtAEkV9
 yKaqmFotgsGfcbJFDi0iTmrDbdcbHu+IjtOJgy6uySnhNT8talapi4qeF1gkNXRoV/
 nJH9k3vNQ72UQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Yqbrg3PvYz6tm8;
 Sat,  8 Feb 2025 04:28:03 +0100 (CET)
From: Thierry Volpiatto <thievol@HIDDEN>
To: Tassilo Horn <tsdh@HIDDEN>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
In-Reply-To: <871pw98no1.fsf@HIDDEN> (Tassilo Horn's message of "Fri, 07 Feb
 2025 22:12:14 +0100")
References: <871pw98no1.fsf@HIDDEN>
Date: Sat, 08 Feb 2025 03:27:57 +0000
Message-ID: <87msexjete.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Autocrypt: addr=thievol@HIDDEN; prefer-encrypt=mutual;
 keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA
 edi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0p
 kcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfb
 tG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQ
 GVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqC
 WcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha
 36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEA
 Ac0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
 FiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8h
 Bp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjRRxferc2G42+ePFIsslx
 hU46VSz1Z83NwIG3mpdYNV5WUTUdgzxExHTNTFCd7NKv0nlHKQaAtdXm5bYnSHsnL7cx8z7lukA/
 EsJocE+GD7QXnsrdlicvdobI0TEN4l73221a72oCvHfYLCVsB6YsNJ5ZGkA1zSjzln5uLAgZ/2r/
 aqlao/AlSZkAk6+hvK0RyAZ/YR4YRZxO8Fsd0gWgFkanRfKfufJ1V0OHZg7yszi3q/hRzS+rZtJ0
 OuzDlh/dyQkxVkZb9vis/+HnGDJrBE5MsmJLcy2Sy3uUnio0fq8q9CrZbudvd1DajlZxPzTm0csP
 eUk45QEgbhEU7MfyAX/mkKxjHajz2cMcHKIap1BqEgJl4BKFeLMcBZ4O1p9ivwtf1Ht2JTp5lOi0
 ItPfhQ4DP8LZ1ZIkN5Kg9v0cyw9meRzAuuR0V2GtzsDNBF8ylcIBDADnIDHEkmk4lUwTlOhwb2yj
 UfmGPnpH3MCCHkjM9H/P1gTHxFWtwFVPcNMCwXWvKSBTF2dZXKERD0yzG06zT53ZMN7EIIeuY6m4
 R8IcMvpohciisWxbFoB4ZY117tVSeqjo946itgbpdeESKl9a8dpn7ytZMyYxPdojlQAqxeAJ8444
 raESh1oTKXb64hlk4l2pSRlrLgjpJBo8asAfZndaxIUKhw68tV8sqeZh9P6cGtHbUELKVJqefNV7
 V7jF5wf3xvRG6Ces3kSKXalLfs+vrVaoOjQeWrc0AtwFWHmt9JLfKrqF+Q2Q7jUidboWmazQM56E
 SJFPpPHmWq8k6DHspsFHOforLouTHJL1556IPne7IV2BGfWc0+xLxalZ8F5F+vnPF/OkrC1CD5iC
 KTjXKa2iZbcYdYQAiL6P8Ac8CgN6EkhpbxRtzrEgChuNGevdi/G/GHG4Zqrh6YFwIa/NHq2aVaFq
 5C1yNTMJd1FRjRzs5JPPlJKpYDnNx+MSp7UAEQEAAcLA9gQYAQoAIAIbDBYhBCPbcH0Te6954oP8
 cA7FbRQdFu+TBQJi9x1ZAAoJEA7FbRQdFu+To6QMAIcvUSiFwCIggxkmYy3ZY0QAMLmIPga8DNPM
 XbfSOBDb2KLGBd+FAA8p2GExpul4r6kOYnGogtojByHmVgrd30/3ZURTM8Vj51wwD05viMZccQHl
 Wd9J/qZIvhBJlJWYnwVxh+2Kg4/hkx7SGc7JJS5GS37+PFQOJHPGMxc+fe4Ty2FdjIOVf3P1Hov9
 K6yBI7Af66qqcL3aKJ4jJidRYN8sMaKOqEu4rcSpTxp8/3Ddbs9HezUgXeUzOLJMcEYFlvCyC8ZS
 l/QDZmpobKbxZ1JAqZM8lnmcZYSV7OsWnxJIYDV1gH5LTLj7bGswXaB4B+qkckihWkRZixu8q1IK
 0c/xwUzyF092uFRM/sQKrSmnwA1+hQiiIuEl4XVz5li0/TmMta3ijUM7GNbl2IjioTRxWWecwad1
 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ
 TgUq5UmBc7YZ0JYWQgPTbQ==
OpenPGP: url=https://posteo.de/keys/thievol@HIDDEN; preference=encrypt
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76132
Cc: 76132 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Tassilo Horn <tsdh@HIDDEN> writes:

> Tags: patch
>
> Hi all,
>
> in a recent bug report the topic macro hygiene came up, i.e., that a
> macro which introduces local bindings in its expansion better uses
> uninterned symbols for those in order not to clash with code passed as
> macro arguments which are spliced into the expansion.
>
> Clojure has a very convenient feature to make that easy.  While you can
> write such macros traditionally like
>
> (defmacro foo [x y]
>   (let [xv (gensym "x")
>         yv (gensym "y")]
>     `(let [,xv ,x
>            ,yv ,y]
>        (do-stuff (* ,xv ,xv) (* ,yv ,yv)))))
>
> you can also write much more concise and convenient
>
> (defmacro foo [x y]
>   `(let [xv# ,x
>          yv# ,y]
>      (do-stuff (* xv# xv#) (* yv# yv#))))

Don't we have cl-with-gensyms which is very convenient as well?
In Helm we have helm-with-gensyms which is the same (Thanks Michael ;-))

> where each symbol ending in # will be replaced by a unique gensymed
> symbol (per name).  The expansion of the two macros is the same.
>
> Would there be interest in adding something like that to Elisp?
>
> I've attached a proof-of-concept implementation where the feature is
> provided by a macro with-uninterned-symbols [1] which you simply wrap
> around your backquoted form.
>
> [1] In Clojure, it's a feature of the reader triggered by backquote.
>
> In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.48, cairo version 1.18.2) of 2025-02-07 built on thinkpad-t440p
> Repository revision: 1751739152149608d28853782ce53b0b9a749bb2
> Repository branch: master
> System Description: Arch Linux
>
> Configured using:
>  'configure --without-native-compilation --with-modules --with-pgtk'
>
>

-- 
Thierry




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at 76132 <at> debbugs.gnu.org:


Received: (at 76132) by debbugs.gnu.org; 7 Feb 2025 22:25:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 07 17:25:20 2025
Received: from localhost ([127.0.0.1]:37148 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgWmm-00015G-Bw
	for submit <at> debbugs.gnu.org; Fri, 07 Feb 2025 17:25:20 -0500
Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:9320)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <drew.adams@HIDDEN>)
 id 1tgWmi-000150-Qn
 for 76132 <at> debbugs.gnu.org; Fri, 07 Feb 2025 17:25:18 -0500
Received: from pps.filterd (m0246627.ppops.net [127.0.0.1])
 by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 517LfqAY007996;
 Fri, 7 Feb 2025 22:25:15 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=
 content-transfer-encoding:content-type:date:from:in-reply-to
 :message-id:mime-version:references:subject:to; s=
 corp-2023-11-20; bh=TtFT6Nqn5ojZHsbaVNhNYvryQA1PthrEE8iZDTctePI=; b=
 XTVlLmjvTIIN7KChBFMPZkY8Gy673wPjoMsxZHfVXDo2aPijJHGmyvfjerAeDIWr
 B0UNCNXz5IesSb2mLqQgeBCG7Wm2uW/LRU5ePIu/k11qaHxbN9VYWi/R1sQG+YyA
 5vxcECEhFI/wAFfF4o/z19eoDLpUY5q5TM2F5nlpkOY1kH/WF4s0MZQzBDLQIA2W
 YJrDfzy4hiKt/EIB6b8pemYKB/KSVrhM7FCWgexrhIY9t851FPvvnmOzDy2skVND
 h3u5EsqSysnemZZt3meD9ccVgPw9CN1lKBI5AvB96qkUULRbocXr4QiHWNDEQZnn
 gafJYIcAWhQfpvwIwIO5vw==
Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com
 (iadpaimrmta02.appoci.oracle.com [147.154.18.20])
 by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44nqb18d9x-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 07 Feb 2025 22:25:15 +0000 (GMT)
Received: from pps.filterd
 (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
 by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2)
 with ESMTP id 517KsBlC027891; Fri, 7 Feb 2025 22:25:13 GMT
Received: from nam11-co1-obe.outbound.protection.outlook.com
 (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174])
 by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id
 44j8p7tmnb-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 07 Feb 2025 22:25:13 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=Q0+CB0cZ21ANT/1NUVOlNsMgBV/L6cwVlaKBxTF5mk2QHnIuOC0dc6DP3kNr0wHywzvAQjbU7x01tOygw68tYkFcCayBGuOYTBhUS6QkGW/j6YLkoQtQc2Rhv6uH+QIdjTTZ7tnQ8s+1t1hEgmP36bUGRwY3LFpq6w3hIf4hDRUg6VvVES/l+Hi01evENP5faWVjNj1m7Wh4u8Quh6+RmVYQMRx4LJP4HzHFW13u+HUNg32ll0SfV1igrybb0HWiLXVv4SczQGH1r9dOuU9zyjOBZk6idf9Svt4Z/uXi9uSlG5h2fINSQJ4HUHN15GBp27wwIXvA8+q1Pnys31y8Ig==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=TtFT6Nqn5ojZHsbaVNhNYvryQA1PthrEE8iZDTctePI=;
 b=hPJWBZ9C72T+qi6p1Ap7wNukP+Jajnr4fJoYxaXBl+WB3P/Zyd9iwoXYaKWx+DRLQAJQaBj9YeqLRE2MSzgw6kAwvDTBJRUURJFOvP56RPyOops9ivMcFLKHHYfMOeFpeg2ORt1/c3bliTtRNfFiFElivQBYSpvegxip79bj0MOOdTQS+NSS/cIPYvdl2ipo4an7/0gCbye+Jr1heZub/SjLeH43FXg4CILx5HYQyoofK8YNUs6s9Kdg4fqox9hubQEpb7EJQbjpHmWuVZ2cGfkpaJYrAlTenEv+nOKInTk+BxzIDYgAxJyj52NpDRZgPkaWYDRq2mGXI+xDiJH8tQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
 dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=TtFT6Nqn5ojZHsbaVNhNYvryQA1PthrEE8iZDTctePI=;
 b=kgfGUVtxppxVSmTLoWrC8KQnjzCuUg0JG8mhxr1mt0ahvcyOmTOi7kRmQ1C8Qgq8pt+mJDmUUq/2IlZTmkQZYfRbv8IoXetONT3bwEqfV87o23iNbfje00zk9vK6e7dTSNExZbWw3Be4+wQad7iSpQqNRBTAATQcVjViz3bdn9s=
Received: from DS7PR10MB5232.namprd10.prod.outlook.com (2603:10b6:5:3aa::24)
 by BLAPR10MB5027.namprd10.prod.outlook.com (2603:10b6:208:333::15) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8422.10; Fri, 7 Feb
 2025 22:25:10 +0000
Received: from DS7PR10MB5232.namprd10.prod.outlook.com
 ([fe80::8303:658f:14f8:2324]) by DS7PR10MB5232.namprd10.prod.outlook.com
 ([fe80::8303:658f:14f8:2324%4]) with mapi id 15.20.8422.012; Fri, 7 Feb 2025
 22:25:10 +0000
From: Drew Adams <drew.adams@HIDDEN>
To: Tassilo Horn <tsdh@HIDDEN>, "76132 <at> debbugs.gnu.org"
 <76132 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#76132: Clojure-style auto-gensyms for macros
Thread-Topic: [External] : bug#76132: Clojure-style auto-gensyms for macros
Thread-Index: AQHbeaUtleJhfuFs5EqJDXFAdMhtmbM8YbGw
Date: Fri, 7 Feb 2025 22:25:10 +0000
Message-ID: <DS7PR10MB523282B0BEF50BD59FD01B3EF3F12@HIDDEN>
References: <871pw98no1.fsf@HIDDEN>
In-Reply-To: <871pw98no1.fsf@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: DS7PR10MB5232:EE_|BLAPR10MB5027:EE_
x-ms-office365-filtering-correlation-id: 17ecb53b-6481-430b-fff2-08dd47c648e2
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700018;
x-microsoft-antispam-message-info: =?iso-8859-1?Q?ZfGbKYPfFagSaGpmhs5SbkTsSABUDFEn2SOLq5yzDdFlr+SdBYrCV5/eII?=
 =?iso-8859-1?Q?n0GV0a/wanglEeAoN25T6sZINGT93j2byrOYVtYoRxjzNVO25zjb7tBlfl?=
 =?iso-8859-1?Q?jVyDLsG5pnbj00dk5bo4y+5xnPR/8PxdViuXW5g28vbamoNrO93XKe9HVh?=
 =?iso-8859-1?Q?k3lIZyPtKXxVDHlY3dKX0Z+pkCmoLkljdu9XdS05vxWLyQbOzx/rmfjogJ?=
 =?iso-8859-1?Q?QWpId9/JC6NCgWkgcMFKqFaC5FBSJB6FGIXarf8LJQ91KCrJlbNBBzFXIa?=
 =?iso-8859-1?Q?lHrOzd+t4higEB6CG+nRzqYuZrFifRoPiLbu4SfxD6nYGUooBtaq4ZfZcA?=
 =?iso-8859-1?Q?E44YOVtLQMZbDsi+eFOneUGa1ZJLJHbBUcsrE3ewZuhjYJpgKF1NOBeLvO?=
 =?iso-8859-1?Q?5YrJueT+uTcoB/RG5ZjvMTwnoDOwyT1uuUuxO1neEj8j27wr0tb5bYJ0eO?=
 =?iso-8859-1?Q?rPGPfpbM4dJjkKQwJdPai1iSLrFZOjaqcWGTx2b6GTlWSbs3cjSDOPxvPU?=
 =?iso-8859-1?Q?etuVUNWpHFnZ4x+bQxXhEX7uDpIIJ/z4WjPYaQSmNgBq51UZmvlNcH0Nle?=
 =?iso-8859-1?Q?/g1XpmWO+SVDlDA0GmdllEavZxLO/94OBmwCDVXo0wFUwmjsfoUq9l8eoE?=
 =?iso-8859-1?Q?QxWJWbRn5eYSi0gLrsGQtEAejBSgxOb9fOv8NMWabnqcR8wEPrI+2qocFr?=
 =?iso-8859-1?Q?fVLv+KF5NXVUDxGUxuXBJXQkJgw1RLltPjziM41Se2jo83fCXTkGvzF+4t?=
 =?iso-8859-1?Q?gAdCeHqvyJbUURvDIwRLZ0bUjB2++K3U1qvh/G+wsREu9KZP7edMIjRPBX?=
 =?iso-8859-1?Q?xFPfw6AWw2dX7rCcPoXQ7SR2nuR5hiMg33LsbN4uQMPrRXqnkcx4IAF6X3?=
 =?iso-8859-1?Q?q0MnDEMcBlogcdmjhY9cFaSwxcEvpcZUGlU+UBMNMblohoa0tIACsGjnTf?=
 =?iso-8859-1?Q?jjYMzjjOic4tTM8WB4IuVNUpJ98qFN5vj6A5UZE+/2kysLw+gk3cT0qhEL?=
 =?iso-8859-1?Q?C9ZyNO3pFBcgQgerm1trmv41Y0chPTm4WQvMpDnXam+KH4t0DF9VKvnrS/?=
 =?iso-8859-1?Q?aTh2j7Sr++J+NfFBbW9Do0cViCqMAKtEokMsP/xPKmhcJUw0ir0ltDbycc?=
 =?iso-8859-1?Q?DdleyCbZ04DPcw6MCf1wggqPeN4QHwSlVAqFUIpPHA3N3CFTg1gxjYEVr4?=
 =?iso-8859-1?Q?oeyr7LDq7uiy4GvsANp6J9+q7rLOrckUhoAMv74/5gii4/dSl0fBe7Hwow?=
 =?iso-8859-1?Q?36VTkhHwJFk2or+wFgWxAKqu8pwT4KOOXGrcTvxgrEDzm5oWYP41fUcSX1?=
 =?iso-8859-1?Q?7pj2aS04N+4rRPhyM4VpyCpL35y6C8crxIFly+7UQp9IrXmxd1Achhgrz+?=
 =?iso-8859-1?Q?UGc3zVrvghGlVV6i+0wrwkYDd+8/z+WNFO4PSH42hO7ynVFsm0WDIEgnY6?=
 =?iso-8859-1?Q?BSeAmD+OlFI8IzJUW39ApxuilsAe/b77OUTeCMnK0yYal6xyySlNJ8En+G?=
 =?iso-8859-1?Q?2vIG+a2VKgFh41AxbKhCkI?=
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:DS7PR10MB5232.namprd10.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230040)(376014)(366016)(1800799024)(38070700018); DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?Ma/NnByxNylOr2hY5ApeO25T2fTtbrxCXMJYlivM/HlOKouC2wnuE3nIkC?=
 =?iso-8859-1?Q?mfCk3Wpv/dXTH3083h7cVLfTfT9EDGbdoIijbgh/IHjhTRqg3/o4DpPf0O?=
 =?iso-8859-1?Q?A0IW6DrCKbkpD5yeNUsTZJqB6xMs4nc+SrOJQ7O/hetkziY6+Dxc90fxLA?=
 =?iso-8859-1?Q?WH3abTCdYy6mnc8sIz1pq0vRB+YKl8RhyqRHaVck1XaPc+C1jU850YjZEp?=
 =?iso-8859-1?Q?GL8cU5xOv0NN0/pDQ8rNTMRaA6p8ISoxNd9q9qXbZSpmZn3fLIE6VdT7Av?=
 =?iso-8859-1?Q?vCPiUb5BzsIiv9It3Mx3oTcc4fFC/pE1MGHSbk0NpdNEDxOIIt3yheMBxW?=
 =?iso-8859-1?Q?txHmHa2G9Iy8Oe7+9fqcB8v3d4FWHu4BPIYR/yEWZB+jYxhZZ9Kgsz8s/m?=
 =?iso-8859-1?Q?6L+eulo6pZ7VdKvd8KXQ+eLGRBkdKMY2a1MnyHSz0dR+74eIRVPolqeaDM?=
 =?iso-8859-1?Q?aZnRjyHMC4bNx5A8XsbhG8emuwmU8FH94DpAMSKiEOgCZJQ/vsFPwsPjNF?=
 =?iso-8859-1?Q?c8FaDyR7C9pO0RGjUj9JRbtSY92h5xgerbOBoc74d53IauKu7g1A2I2Vwn?=
 =?iso-8859-1?Q?zUUR+kt2rg7+Z0DLLEXpdtmTvzNffVbO9c3nJwGlNTTYG5oBLwxDw5Kjv1?=
 =?iso-8859-1?Q?KibzXGhUxMvhDiirOLg80kesI5j4e/2xKX0sZdoClZgdq/xvISYCriuzET?=
 =?iso-8859-1?Q?NjpmR6ntFiCVt4KazvZqjywOC2a5aqSa0cXfcVXj8iy26wlIdIRBR85Lvc?=
 =?iso-8859-1?Q?Vg9dx0zOhRgOJBu8IgNxL0nMEpMg7MvTpQ2G7HohGVrIrOHjtnzXmxmKnX?=
 =?iso-8859-1?Q?RjyLF5lhHLgvmbmu60witYF1d0lixzVHVztO1ywhmv7mAn4LQB8vajPLae?=
 =?iso-8859-1?Q?iYaNu0uSauz6v52m6qSqlDSXQJACuyOou3JJS0uZ/BkpaifLk9NkIBJfz1?=
 =?iso-8859-1?Q?WDLyiKdOcYnfTJ3X+zw0WAHKH2TkQ0xOV6TeQz8OuKvK9lT1TTMRpyUadU?=
 =?iso-8859-1?Q?T850CNxhtcUmm0Ild9vZ5C3SITBZbQ9JiUk1DMD5VxdcZDd5IrO75iPbzd?=
 =?iso-8859-1?Q?tSHYqeqwvOI1OQxvTYHAZyQ7EUZy1btSePAb4+aarfRR8xJA8zd+61/Yh8?=
 =?iso-8859-1?Q?1zP3NX3OT6AIA0fDGNG2ih/h23Kp1BuI85u4HjLWJ12CP1HBlAa14x7lVy?=
 =?iso-8859-1?Q?1mePbraRWmjvDCV2cW/o3t3mvEjPKbcslemtWLzoswCvfOgwv/1zJgl0zK?=
 =?iso-8859-1?Q?vqS61w+1875poY7ba137kCERKAUpVxjRaCd4zyzuPDFvG7/si0p2EaaLnP?=
 =?iso-8859-1?Q?GTi0W0tYbz96MIJeiuQFb5Ts4nGbUGl0O0uleRa1x3JJ/xkeJFimqSQeHa?=
 =?iso-8859-1?Q?RugXgfBhC9sCEkJ8cZB8aVs+PUFDnNmT2zfxoGyhDvhhC4PAvrY7aqcxTR?=
 =?iso-8859-1?Q?G8xJGN7JjpUJ5TKqBdD6LKR4rtZYrGOWTjyPI2Zw4duQapbIsQvECQMb5U?=
 =?iso-8859-1?Q?vJyafniTRUsBDgpSAe7BI3EXE9an0U/G/KqDTkDjToQMXS2A4OFlB4s/Nr?=
 =?iso-8859-1?Q?v6W2o6PIOvoI8ti96RwyNF0SLn/ycRS0cixhOroV9moXL3SBaG7t3UmeVg?=
 =?iso-8859-1?Q?Zvf35LXX1OtbpvrxP52XLkCDdtn8pE5MZb?=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5kLmvaBa83/kLN65kMs7cbEOGtEPToEWaA8+am6GJpCeXstTqygN2KfKr82V39LS7HmYLQcqTIlT/5vLN0ro0PtMK1JHI1ProCMomEmIG6RoZ6qSRL+AbUzn3FfQaENdm/aFIuENzyXjsoyHQg2tqjoldqn+kIX2D6k9mrC/baB2LCGyaYCoZS6Pph+mOgu8aenFBM1yQ1O8AjKPIvyanPdteGAAKJPFs90aR/zCbuVJJ3gqChAOvq5E0ojHXPJnKd12gWzVIGXOUZCn9QSFgoE8NedjJ40d5ktJgHiqhLHZY165ZfF/WPHpdhz04u+n5aNSu6HiHRlHIAqC+ALTeA5KAUuDVLjDH8M0ZZIdCmLJnUFB1EPGOXCsMnt2GZArJTwoyqc7hnti2g8sQmxT6ZuRgfB7ijndboS0AD151lJJYb3CPMQmIZ3LDozAAM7Igtb3y9hUkYKHCPHgYxTRYQnAtbhx3imnEyFkfkJ4nCDS9yGxpLL46yH/HtxP//5lFWAKcOGPpPIszKkmIEE680z+0tPETTKRweoaFGxxe9BYWyD7drz5q7SKBG2MZBFA5ncEk2WK0QTNRRGnB+bbmtKuqWbmzb52h+P7xGIFIfE=
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5232.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 17ecb53b-6481-430b-fff2-08dd47c648e2
X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Feb 2025 22:25:10.8120 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: AKZwzZraLnXwWB42HpFEpJvfKieJIA2WPMB/KKipiWLr5GGOOPtl3Kmnt6fvI4uHBEFdXzM4wUUBH0MCkV7hBw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5027
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34
 definitions=2025-02-07_10,2025-02-07_03,2024-11-22_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0
 phishscore=0 suspectscore=0
 adultscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=835
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2501170000
 definitions=main-2502070169
X-Proofpoint-GUID: zDEzwP6weniPLX8JTi7vYIp2jFrIVBsG
X-Proofpoint-ORIG-GUID: zDEzwP6weniPLX8JTi7vYIp2jFrIVBsG
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 76132
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Clojure has a very convenient feature to make that easy.  While you can
> write such macros traditionally like
>=20
> (defmacro foo [x y]
>   (let [xv (gensym "x")
>         yv (gensym "y")]
>     `(let [,xv ,x
>            ,yv ,y]
>        (do-stuff (* ,xv ,xv) (* ,yv ,yv)))))
>=20
> you can also write much more concise and convenient
> > you can also write much more concise and convenient
>=20
> (defmacro foo [x y]
>   `(let [xv# ,x
>          yv# ,y]
>      (do-stuff (* xv# xv#) (* yv# yv#))))
>=20
> where each symbol ending in # will be replaced
> by a unique gensymed symbol (per name).
> Would there be interest in adding something
> like that to Elisp?

So you could no longer let-bind a variable
whose name ends in `#', to get a normal let
binding?  (Admittedly, you need to write that
as `\#' in the source code.)

Doesn't sound like an improvement, to me.
A priori, I'm not in favor of limiting the
names you can use for variables.

That would be especially pernicious with let
bindings of dynamic ("special") variables.
If it were limited to lexical variables it
wouldn't be so bad.  We should be able to
bind dynamic vars whose names end with `#'.
(Again though, admittedly the `#' chars need
to be escaped in source code: `\#'.)

The clich=E9 of handling this kind of thing in
macros with gensym is pretty standard (it may
even be the main use of gensym).  Yes, it can
be error prone, but it's not really harder to
use gensym than it is to add `#' to var names.

And the body is IMO clearer without the added
`#'s and subtracted commas.

There might be some other way to provide such
a shortcut, without removing the _general_
possibility of naming let variables with `#'
at the end.  A new variety (yet another?) of
`let' perhaps, that does what you suggest.

I'll note too that Common Lisp doesn't bother
with such things either.  And people have been
writing Lisp macros with Common Lisp and its
ancestors for many, many moon.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Feb 2025 21:12:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 07 16:12:31 2025
Received: from localhost ([127.0.0.1]:36924 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tgVeJ-0005fT-9a
	for submit <at> debbugs.gnu.org; Fri, 07 Feb 2025 16:12:31 -0500
Received: from lists.gnu.org ([2001:470:142::17]:58806)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tsdh@HIDDEN>) id 1tgVeG-0005fC-7f
 for submit <at> debbugs.gnu.org; Fri, 07 Feb 2025 16:12:30 -0500
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 <tsdh@HIDDEN>) id 1tgVe8-0000BL-IL
 for bug-gnu-emacs@HIDDEN; Fri, 07 Feb 2025 16:12:22 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tsdh@HIDDEN>) id 1tgVe8-0003S8-8w
 for bug-gnu-emacs@HIDDEN; Fri, 07 Feb 2025 16:12:20 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to:
 references; bh=abdukFb36Sw/O5w57CsldPuKonLsWEE7C4RP6eR8xE8=; b=Lj1bzdAlXKNxPh
 YNOLQqwMIGsIZf8OrHEttAVOo5CsBEUpuzDn9tko+VbA9yfBs/eIu7FJaQG3EffvC9e+Gb/yUq3b0
 C2MPTY8J99OOKDswKIyTa8JfPhQr0/rLaqv7Jvc/5RCyPL+E0LWfoQidkT9X7EEF89AV3bwyPKZKH
 YdGrOtrLbsRspcAl/CZ1biatsUEZT3yGxL7vIPt3FNVKKf8A1DL4kvNXm5D+JegIohKX4YKbKTjgn
 +5j3M4fVS2Iicmcq1Uzld+ACLyT582v++2RXpVEt+yqKhSr2SUVVm1pWPPurab3ETlZ+jQzEzKz3p
 HI1yYKoU8rfTVR7nABxQ==;
X-ME-Sender: <xms:MXemZxX8qQXxFK0IMBej3c8LBXUF7I7Ex2uaOSiU2BCCpL_KkVHxLw>
 <xme:MXemZxlPLQP2mOPAIzFlA8HhaKR950IKWcqPomnm1M8TbOZo52MRgoU0VGu1GMtAU
 kVzRaibxwYLAA>
X-ME-Received: <xmr:MXemZ9Z7x59XmBDj33gATkj8osopMcUd85xviQO8OH36I-dFpNsMdKnBmR6W2xfWsTox-xs-qxw2jsXmXiBoT9v7PGXwl3An>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdeffecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvuf
 gffffkgggtsehmtderredtredtnecuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoeht
 shguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnhepjeekvdeuhffhkedthefhve
 ehieduffefheegfeehgeeuueehgfektdefudejhfeunecuvehluhhsthgvrhfuihiivgep
 tdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhph
 gvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhn
 uhdrohhrghesfhgrshhtmhgrihhlrdhfmhdpnhgspghrtghpthhtohepuddpmhhouggvpe
 hsmhhtphhouhhtpdhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhr
 gh
X-ME-Proxy: <xmx:MXemZ0VqXUMoB1-U0JWOM_fDPY4fJ50WRP7-GlMJSmIQlyYyVF46Gg>
 <xmx:MXemZ7kBIKYQoFX-hatWUSXY_n_NN2T3_63u3GhYx_imU8KKM8rLvA>
 <xmx:MXemZxeOnwIuDOwHjF_hg_2UbQGlGfGEjRLvz5v1y09iEoN0VxpjaQ>
 <xmx:MXemZ1G7adld_6rCqsANA2Y0gDNUhf-RbVglHmSofR0hSI3aN7_f-Q>
 <xmx:MXemZ1lUrIVmsh-mc9VNuj4o_NIuDDkRJREtDcPEqvgG5AtU2sMla34O>
Feedback-ID: ib2b94485:Fastmail
From: Tassilo Horn <tsdh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Clojure-style auto-gensyms for macros
User-Agent: mu4e 1.12.8; emacs 31.0.50
X-Debbugs-Cc: 
Date: Fri, 07 Feb 2025 22:12:14 +0100
Message-ID: <871pw98no1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Tags: patch

Hi all,

in a recent bug report the topic macro hygiene came up, i.e., that a
macro which introduces local bindings in its expansion better uses
uninterned symbols for those in order not to clash with code passed as
macro arguments which are spliced into the expansion.

Clojure has a very convenient feature to make that easy.  While you can
write such macros traditionally like

(defmacro foo [x y]
  (let [xv (gensym "x")
        yv (gensym "y")]
    `(let [,xv ,x
           ,yv ,y]
       (do-stuff (* ,xv ,xv) (* ,yv ,yv)))))

you can also write much more concise and convenient

(defmacro foo [x y]
  `(let [xv# ,x
         yv# ,y]
     (do-stuff (* xv# xv#) (* yv# yv#))))

where each symbol ending in # will be replaced by a unique gensymed
symbol (per name).  The expansion of the two macros is the same.

Would there be interest in adding something like that to Elisp?

I've attached a proof-of-concept implementation where the feature is
provided by a macro with-uninterned-symbols [1] which you simply wrap
around your backquoted form.

[1] In Clojure, it's a feature of the reader triggered by backquote.

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.48, cairo version 1.18.2) of 2025-02-07 built on thinkpad-t440p
Repository revision: 1751739152149608d28853782ce53b0b9a749bb2
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --without-native-compilation --with-modules --with-pgtk'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment; filename=clojure-macro.el

;; -*- lexical-binding: t; -*-

(defun with-uninterned-symbols--helper (form symbol-map)
  (cond
   ;; A symbol foo$ must be replaced with an uninterned symbol.  Record the
   ;; foo$ -> #:foo mapping in symbol-map for reuse.
   ((and (symbolp form)
         (string-match "\\(.*\\)[$]$" (symbol-name form)))
    (or (gethash form symbol-map)
        (let ((s (make-symbol (match-string 1 (symbol-name form)))))
          (puthash form s symbol-map)
          s)))
   ;; For lists and vectors, recurse into each element.
   ((or (listp form)
        (vectorp form))
    (let ((new-form (mapcar (lambda (c)
                              (with-uninterned-symbols--helper c symbol-map))
                            form)))
      (if (vectorp form)
          (apply #'vector new-form)
        new-form)))
   ;; For conses, recurse into car and cdr.
   ((consp form)
    (cons (with-uninterned-symbols--helper (car form))
          (with-uninterned-symbols--helper (cdr form))))
   (t form)))

(defmacro with-uninterned-symbols (form)
  "Helper macro for defining the expansion of a macro.
Takes a FORM and replaces all symbols whose name ends with $ with
uninterned symbols, one uninterned symbol per name."
  (with-uninterned-symbols--helper
   form
   (make-hash-table :test #'eq :size 16)))

(defmacro th/test (x y)
  (with-uninterned-symbols
   `(let ((foo$ ,x)
          (bar$ ,y))
      (list :args `(,foo$ . ,bar$)
            :add   (+ foo$ bar$)
            :sub   (- foo$ bar$)
            :mul   (* foo$ bar$)
            :div   (/ foo$ bar$)))))

(th/test 1.0 2.0)
;;=> (:args (1.0 . 2.0) :add 3.0 :sub -1.0 :mul 2.0 :div 0.5)

;;=> Expansion is:
;; (let ((#:foo 1.0) (#:bar 2.0))
;;   (list :args `(,#:foo \, #:bar)
;;         :add (+ #:foo #:bar)
;;         :sub (- #:foo #:bar)
;;         :mul (* #:foo #:bar)
;;         :div (/ #:foo #:bar)))

--=-=-=--




Acknowledgement sent to Tassilo Horn <tsdh@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#76132; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 12 Feb 2025 14:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.