Subject: bug#76132: Clojure-style auto-gensyms for macros

From: Tassilo Horn <[email-masked]>
Date: Sat, 08 Feb 2025 08:07:46 +0100

Drew Adams <[email-masked]> 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