[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as tople
From: |
Daniel Colascione |
Subject: |
Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling |
Date: |
Mon, 21 Apr 2014 15:29:38 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 04/21/2014 03:09 PM, Stefan Monnier wrote:
>>>> Correctly treat progn contents as toplevel forms when byte compiling
>>> Your commit messages should be copies of the ChangeLog entry.
>>> Could you describe the case(s) that this fixes?
>> See the testcases. Generally speaking, this change fixes situations
>> where the byte-compiler miscompiles code that contains (or generates)
>> top-level progns that define macros, then use them.
>
> Can you show an example of a macro that does that?
Any macro that expands to something like this:
(progn (defmacro abc (arg) 1) (defun def () (abc 2)))
Some of the iface stuff I was working on used this functionality. The
comments in bytecomp.el suggest that EIEIO has similar stuff. In any
case, it's a reasonable thing to want to do, so we should support it.
>>>> + ;; Macroexpand (not macroexpand-all!)
>>> That could be a problem.
>> Why? We macroexpand-all forms later when we actually compile or eval them.
>
> Not sure why, exactly. It just feels like it could be a problem.
> Usually, we assume it's safe to use macroexpand-all, and it's not 100%
> crystal clear why we could be sure that macroexpand-all won't be used.
We only want to expand the top-level macro to see whether it expands
into a progn. If it does, we treat each form in the progn as its own
top-level form, recursively. If we called macroexpand-all, we'd expand
the subforms too soon, before we'd compiled defmacro forms that might be
inside the progn body.
>> Unless there's a good reason to depart from CL, we should follow CL's
>> approach to things. CL in a good sane default, and in this case, CL
>> specifies exactly the right behavior.
>
> Yes. But Elisp's design constraints, especially w.r.t macro expansion,
> are slightly different, partly for historical reasons, partly for
> technical reasons. It might not be relevant here, but I just want to
> make double sure.
It's not relevant here. I also still want to make those macro-expansion
changes I proposed last year.
signature.asc
Description: OpenPGP digital signature
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Stefan Monnier, 2014/04/21
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Daniel Colascione, 2014/04/21
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Stefan Monnier, 2014/04/21
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling,
Daniel Colascione <=
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Stefan Monnier, 2014/04/21
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Daniel Colascione, 2014/04/21
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Stefan Monnier, 2014/04/22
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Daniel Colascione, 2014/04/22
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Stefan Monnier, 2014/04/22
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Daniel Colascione, 2014/04/22
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Daniel Colascione, 2014/04/22
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Stefan Monnier, 2014/04/22
- Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Daniel Colascione, 2014/04/22
- RE: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling, Drew Adams, 2014/04/22