all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Adding with-gensyms and once-only to subr-x
Date: Mon, 11 Apr 2022 17:06:36 -0700	[thread overview]
Message-ID: <87bkx7tbar.fsf@melete.silentflame.com> (raw)
In-Reply-To: <jwv7d7vwitt.fsf-monnier+emacs@gnu.org>

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



  parent reply	other threads:[~2022-04-12  0:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 16:26 [PATCH] Adding with-gensyms and once-only to subr-x Sean Whitton
2022-04-11 16:48 ` Stefan Monnier
2022-04-11 17:01   ` Sean Whitton
2022-04-11 17:26     ` Stefan Monnier
2022-04-11 18:41       ` Sean Whitton
2022-04-11 19:11         ` Stefan Monnier
2022-04-11 20:25           ` Sean Whitton
2022-04-11 21:11             ` Stefan Monnier
2022-04-11 23:05               ` Sean Whitton
2022-04-11 23:15                 ` Sean Whitton
2022-04-12  0:06           ` Sean Whitton [this message]
2022-04-12  3:08             ` Stefan Monnier
2022-04-12  6:02               ` Sean Whitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkx7tbar.fsf@melete.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.