emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Adding with-gensyms and once-only to subr-x


From: Sean Whitton
Subject: Re: [PATCH] Adding with-gensyms and once-only to subr-x
Date: Mon, 11 Apr 2022 17:06:36 -0700
User-agent: Emacs/29.0.50 (x86_64-pc-linux-gnu)

Hello again Stefan,

On Mon 11 Apr 2022 at 03:11PM -04, Stefan Monnier wrote:

>>> I'm not in love with the name `macroexp-let2*` but I find the name
>>> `once-only` to lack context.  So we could consider renaming, but I'd
>>> favor making it live in `macroexp.el` (and come with a `macroexp-`
>>> prefix).  It could be called `macroexp-once-only` or
>>> `macroexp-eval-now`, or we could go crazy with names like
>>> `macroexp-copyableize`.
>>
>> How about I add an alias cl-once-only, maybe which doesn't accept the
>> TEST argument at all?  It can go in cl-macs.el.
>
> Deal!
> [ I didn't know it was "standard" in Common-Lisp.  ]

I've found a snag.  CL once-only uses let but macroexp-let2* uses let*.

For the example

    (defmacro square2 (x y)
      (cl-once-only (x y)
        `(* ,x ,x ,y ,y)))

the macroexp-let2* version yields something like

    (let* ((x foo)
           (y bar))
      (* x x y y))

whereas CL's traditional once-only would be more like

    (let ((x foo)
          (y bar))
      (* x x y y))

where x and y are uninterned symbols.

At the very least this should be noted in the docstring for
cl-once-only, but maybe it means cl-once-only should use the code in my
original patch and not use macroexp-let2* at all?  What do you think?

-- 
Sean Whitton



reply via email to

[Prev in Thread] Current Thread [Next in Thread]