From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling Date: Mon, 21 Apr 2014 19:21:56 -0700 Message-ID: <5355D244.2050104@dancol.org> References: <535558EA.7070506@dancol.org> <53559BD2.3000006@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x8KjI4K6tFlexBrui7ogpgCxKGKQQeUe7" X-Trace: ger.gmane.org 1398133336 11146 80.91.229.3 (22 Apr 2014 02:22:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Apr 2014 02:22:16 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 22 04:22:09 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WcQLZ-0004i9-0M for ged-emacs-devel@m.gmane.org; Tue, 22 Apr 2014 04:22:09 +0200 Original-Received: from localhost ([::1]:52412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcQLY-0007wL-Ha for ged-emacs-devel@m.gmane.org; Mon, 21 Apr 2014 22:22:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcQLV-0007wG-KP for emacs-devel@gnu.org; Mon, 21 Apr 2014 22:22:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WcQLU-0006mq-Af for emacs-devel@gnu.org; Mon, 21 Apr 2014 22:22:05 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:42174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcQLU-0006mk-00 for emacs-devel@gnu.org; Mon, 21 Apr 2014 22:22:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=rSy3mIHf+jM/7EHGgndQ8pEz7SqAHLe/xpLjWn5OG7U=; b=FW/KCSHrMM+yEmAsilYXIKxFTTMO2McctahrUZHF760jGOkCr9Nn3YbS1Jdkadtd/XBZUPCWQ/nauZJvkEY4A4lzBgK2gbtU5ZD96L7RjofpfpsJJnbPFxXlIFwchP/LP7H4v0v7lJiN46knMiNd0JhEvvY9c6wCQzGogK7Nquuv1ihqxWE+6rT7p4O9PwOqWZMT9crFHJF5lic96hbe19XUjEXX9HxqMyMQcZ6Hey3eynPi+jNWLNw3XdNRMByLVm3O68lWhnsXHdL4jVp3xtLbOItmBYg2xtssd9j+SkACoTZTOZer40GJ2b7vWJacvvlJnTFmaMZiqvGMfhe+9g==; Original-Received: from [2620:10d:c083:1003:863a:4bff:fec8:e538] by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1WcQLS-000594-O1; Mon, 21 Apr 2014 19:22:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: X-Enigmail-Version: 1.6 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:171560 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --x8KjI4K6tFlexBrui7ogpgCxKGKQQeUe7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 04/21/2014 07:09 PM, Stefan Monnier wrote: >> Any macro that expands to something like this: >> (progn (defmacro abc (arg) 1) (defun def () (abc 2))) >=20 > That's not the kind of example I was thinking if. Do you have a real > example, maybe? Try writing a macro that emits a defstruct, then a function that uses cl-typep for that struct, all wrapped in the same toplevel progn. >> Some of the iface stuff I was working on used this functionality. >=20 >> The comments in bytecomp.el suggest that EIEIO has similar stuff. >=20 > No, that comment is about eieio.el using eval-and-compile over large > swaths of code, which is very unusual, so I made eval-and-compile behav= e > more like the usual top-level (before that eval-and-compile expanded > all its macros in a single pass). Yes, eieio uses eval-and-compile, but there's no reason the same toplevel semantics shouldn't apply to regular progn. >> In any case, it's a reasonable thing to want to do, so we should >> support it. >=20 > I'm not sure I want to impose myself this level of detail. > Especially since it'll also have to be ported to the eager > macro-expansion code. Other lisps provide the same functionality that my change does, and for good reason. It's a simple, useful concept: macros can only generate one form, so if they generate a progn, we treat each form in the progn as a toplevel form. Not supporting this mode of operation makes elisp much less useful. The reason we have automated tests is to make sure we can maintain this "level of detail". That it's not immediately useful to you isn't a reason not to include it. I can't believe this issue is even contentious: the current behavior is a clear bug. > And OTOH your macro could expand calls to `abc' "manually" in the code > it returns, and hence avoid this need. How? By locally defining those macros in a temporary macrolet (which we'd macroexpand-all?) in addition to emiting defmacros? What if the macro generation is implicit, as it is with defstruct, so that the top-level form doesn't even realize it has to employ this awful hack? The need for this ridiculous and needless hack can be avoided if we just have sane toplevel macro expansion semantics. Forcing people to rely on tricks like what you propose instead of providing sane macro expansion semantics will waste a lot of people's time. --x8KjI4K6tFlexBrui7ogpgCxKGKQQeUe7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJTVdJEAAoJEMAaIROpHW7IyCAP/0+oqEXmfZLdZCnRZEP8pOgQ BfJuQ0QZZnyOLt3eXLVjXzjf7BAU7WTDxZW7HdnuKYr6FpYxk0Rs6BIKWw/4oFnk a3zB7EZrzSwX/k+ygvlBDRo+kgSMrIneDsP29tCAAw/LNGuYWxUA2ff2tL9NZ83g 1QJ0kUS+R1BCqN+aMPWyEMbNaz1XZSd0/o+9EokjogoSlmPTXV1GWWXwOP0+aXh8 eHQ2RHTc/2D+XGyMHrC9C3OIWQ7DzMxt6pWxswvhrQXU1uLCYU0vOrSBStcXuvLl W/bYmo+ndI0wr1ddYX1DwWZDSw2+PqobpGal+V0IbAAXAaNupnTKtcqBcFkeQnIy GX3HAGEbq2XeuL+J5goeq5BKqPQRkANd+edmM06SWRXEmnxhsZPs/orfDadKq2c6 qyvla0WlsDbLN8MTH2pE/z/GJO/SyRCQnD2zUmoOKrPb2uCrMNenGsWmngboLzQa fhQSRGrHm8KFjSbiEdt/VxaA5VPRt0NKAHcxxEaXGz6PxRDxKR6ommpk/6ZbPhth YxSWvdx5Xb8budLSXrpDCpibNra1fGVH3aXFpRzPzghPmS9VJGy+4CAbayr3LPaH V8JeTalC6kCC5GixSPIV5fcWxKpHl3dUxGMaDMMIshWGcTjnub4f7QmK++/dWYr6 fxOscxi+0O4HsiqFURGa =UWZW -----END PGP SIGNATURE----- --x8KjI4K6tFlexBrui7ogpgCxKGKQQeUe7--