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

From: Ship Mints <[email-masked]>
Date: Sun, 9 Feb 2025 04:22:05 -0500

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 AM Tassilo Horn <[email-masked]> wrote:

> Ship Mints <[email-masked]> 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
>