emacs-devel
[Top][All Lists]
Advanced

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

Re: A combination of defmacro, functionp, and quoted lambdas yields diff


From: Clément Pit-Claudel
Subject: Re: A combination of defmacro, functionp, and quoted lambdas yields different results on consecutive evaluations
Date: Mon, 26 Feb 2018 12:15:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 2018-02-26 11:37, Michael Heerdegen wrote:
> Hello Clément,

Hey Michael,

> Are we sure `mmm' always does what you expect?

Hard to say. I'm trying to gauge how much of what I observe is a bug, and how 
much is expected :)

> Note that it gets called
> with different arguments in these two cases.  

I think that's a problem, yes.  But is it the expected behavior for it to be 
called with different arguments?

> You have
> 
> (mmm (lambda () nil)) ==> (lambda nil nil)
> 
> With the `with-eval-after-load' called before `mmm' is defined, I get an
> entry like this in `after-load-alist':
> 
> | (test-macro
> |   #[0 #1="byte code..."
> |       [(lambda nil
> |          (let
> |              ((out
> |                (mmm
> |                 #'(lambda nil nil))))
> |            (message "with-eval-after-load: %S" out)))
> |       ...]
> |       11])

Right, I think that's broken.

> Maybe you can change `mmm' so that it handles both of these cases as you
> want?

We're considering this for Flycheck, yup :)  I suggested a similar solution in 
https://github.com/flycheck/flycheck/issues/1398#issuecomment-365660601

Or use a function like (defun mmm2 (f) `#',f)?

I don't think that works for our particular use case, because we need to handle 
unquoted functions.

Mostly though, I'd like to understand where the issue comes from (my current 
understanding is that it's a miscompilation), and whether it can be fixed.

(The original problem popped up a few years ago from a user of use-package, but 
back then we didn't track it down; this time I'd like to fix it once and for 
all)

Thanks for your help!
Clément.



reply via email to

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