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


Message #38 received at 76132 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 76132 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#76132: Clojure-style auto-gensyms for macros
Date: Sun, 9 Feb 2025 04:22:05 -0500
[Message part 1 (text/plain, inline)]
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 <tsdh <at> gnu.org> wrote:

> Ship Mints <shipmints <at> gmail.com> 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
>
[Message part 2 (text/html, inline)]

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.