emacs-devel
[Top][All Lists]
Advanced

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

Re: defmacro with built-in gensym declaration and initialization


From: Stefan Monnier
Subject: Re: defmacro with built-in gensym declaration and initialization
Date: Thu, 21 Jan 2021 16:05:53 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> Sorry, I suspect I misunderstood.  What's a native arglist?  Doesn't
>> defmacro already have native support for &optional and &rest keywords?
> Yes, and that's what I mean by native arglists - the ones possessed by
> built-in C objects such as subroutines, lambda expressions, compiled
> code, dynamic module functions, etc. and used by built-in C functions
> such as funcall.
> By contrast, cl-defmacro, other CL compatibility definitions, etc. have
> to parse a plain Elisp arglist for CL-specific features like &aux.

FWIW, `defmacro` is itself a macro, just like `cl-defmacro`, so it
wouldn't be that terribly hard (the only problem is that it needs to be
implemented without itself using macros, more or less).

For me it's more a question that whatever something like `&gensym` can't
use values that are computed during the macro expansion, , so

    (defmacro M (ARGS &gensym FOO)
      ...)

is equivalent to something like:

    (defmacro M (ARGS)
      (with-gensyms (FOO)
        ...))

except:
- it's a bit more concise
- it exposes internal implementation details into the arglist, which is
  usually considered as part of the signature.
- it doesn't cover the cases where you need `with-gensyms` deeper than
  at the toplevel of the macro's body.

I find the added concision doesn't pay for the other two downsides.


        Stefan




reply via email to

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