bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#41381: 28.0.50; Can't compile file containing a local pcase macro


From: Pip Cet
Subject: bug#41381: 28.0.50; Can't compile file containing a local pcase macro
Date: Wed, 03 Jun 2020 21:59:36 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

Philipp Stephani <p.stephani2@gmail.com> writes:
> $ cat test.el
> ;;; -*- lexical-binding: t; -*-
> (pcase-defmacro test () '_)
> (defun test () (pcase nil ((test))))
>
> $ emacs -Q -batch -l bytecomp -f batch-byte-compile test.el
>
> In toplevel form:
> test.el:3:1: Error: Symbol’s function definition is void: 
> test--pcase-macroexpander
>
> It works if the pcase macro is surrounded with `eval-when-compile', but
> that shouldn't be necessary I think.

Wouldn't it be better to surround the pcase-defmacro call with
(eval-and-compile ...)?

I think it would be great if there were some clever way to make eager
macro expansion less eager, so things like evaluating the following two
expressions one after another

(defmacro foo () 3)

(progn
  (defmacro foo () 4)
  (foo))

would produce the right result (4 rather than 3). That would solve this
problem as well, but it's probably impossible to do with reasonable
performance.





reply via email to

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