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

Previous Next

Package: emacs;

Reported by: Tassilo Horn <tsdh <at> gnu.org>

Date: Fri, 7 Feb 2025 21:13:02 UTC

Severity: wishlist

Tags: patch

Done: Tassilo Horn <tsdh <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Tassilo Horn <tsdh <at> gnu.org>
To: Thierry Volpiatto <thievol <at> posteo.net>
Cc: 76132 <at> debbugs.gnu.org
Subject: bug#76132: Clojure-style auto-gensyms for macros
Date: Sat, 08 Feb 2025 08:15:55 +0100
Thierry Volpiatto <thievol <at> posteo.net> 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




This bug report was last modified 146 days ago.

Previous Next


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