all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <53559BD2.3000006@dancol.org> (raw)
In-Reply-To: <jwvioq2nxvp.fsf-monnier+emacsdiffs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

  reply	other threads:[~2014-04-21 22:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1WcAcP-0006zy-MJ@vcs.savannah.gnu.org>
2014-04-21 15:09 ` [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling Stefan Monnier
2014-04-21 17:44   ` Daniel Colascione
2014-04-21 22:09     ` Stefan Monnier
2014-04-21 22:29       ` Daniel Colascione [this message]
2014-04-22  2:09         ` Stefan Monnier
2014-04-22  2:21           ` Daniel Colascione
2014-04-22  4:25             ` Stefan Monnier
2014-04-22  4:46               ` Daniel Colascione
2014-04-22 15:06                 ` Stefan Monnier
2014-04-22 17:22                   ` Daniel Colascione
2014-04-22 18:13                     ` Daniel Colascione
2014-04-22 18:37                       ` Stefan Monnier
2014-04-22 19:08                         ` Daniel Colascione
2014-04-22 18:44                       ` Drew Adams
2014-04-22 19:23                         ` Daniel Colascione
2014-04-22 19:59                           ` Drew Adams
2014-04-22 20:10                             ` Daniel Colascione
2014-04-22 20:41                               ` Drew Adams
2014-04-22 21:05                                 ` Daniel Colascione
2014-04-23  0:50                                 ` Stephen J. Turnbull
2014-04-22 18:29                     ` Stefan Monnier
2014-04-22 15:20                 ` Stefan Monnier
2014-04-22 17:04                   ` Daniel Colascione

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=53559BD2.3000006@dancol.org \
    --to=dancol@dancol.org \
    --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.