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 10:44:10 -0700 Message-ID: <535558EA.7070506@dancol.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Qssvmuw5m66EJlGkLINlggNFJ7lbDSU3U" X-Trace: ger.gmane.org 1398102792 10588 80.91.229.3 (21 Apr 2014 17:53:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Apr 2014 17:53:12 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 21 19:53:06 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 1WcIOv-0007lD-M2 for ged-emacs-devel@m.gmane.org; Mon, 21 Apr 2014 19:53:05 +0200 Original-Received: from localhost ([::1]:50596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcIHq-0002Yk-D4 for ged-emacs-devel@m.gmane.org; Mon, 21 Apr 2014 13:45:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcIGL-0007oo-Ga for emacs-devel@gnu.org; Mon, 21 Apr 2014 13:44:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WcIGK-0000kZ-Hi for emacs-devel@gnu.org; Mon, 21 Apr 2014 13:44:13 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:39760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcIGK-0000jn-Ai for emacs-devel@gnu.org; Mon, 21 Apr 2014 13:44:12 -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=t6Uje69C+UJ+LQa1+VIl3DyuCXcfB1Gh5AQhXfJgjxw=; b=dhkFv19vEFHo6ONTbvAEHGVcwe3ZuB2RkbC+J4mGmSZ2QRDYIIOJVzz82nCOQ0uEKjQQ6iGqVKP8tVW3brn410/k99Fdc0DHJvWYWJbzIG4/Dyvzyl9e0l+etDr3TBHBGTsemvls/0R4+h3JamRTd/YsOx9vlcjnE6K/wUeNDKTVvG9VofvTKqBdUOyIpUG/df8n+KDiokLpcyJ9P+RT8MA22dyEkS/5I69t+oZGpyExbzonxiyXiEbtaJ+atm/rhKYpbam4XwTl8bm13d0U1+SYEhc6zr4MgDrklt95SPMLjdWhuBjrKEtfUv2l7/jIxpbonxyh0TbyFFlUT9wGUg==; Original-Received: from [2601:8:b200:2b6::2b1] by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1WcIGJ-00036w-Qy; Mon, 21 Apr 2014 10:44:11 -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:171542 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Qssvmuw5m66EJlGkLINlggNFJ7lbDSU3U Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 04/21/2014 08:09 AM, Stefan Monnier wrote: >> Correctly treat progn contents as toplevel forms when byte compiling= >=20 > Your commit messages should be copies of the ChangeLog entry. >=20 > 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. >> + ;; Macroexpand (not macroexpand-all!) >=20 > That could be a problem. Why? We macroexpand-all forms later when we actually compile or eval them= =2E >> form at toplevel in case it >> + ;; expands into a toplevel-equivalent `progn'. See CLHS section >> + ;; 3.2.3.1, "Processing of Top Level Forms". >=20 > Note that Elisp is not Common-Lisp, so we don't always follow > Common-Lisp's design decisions (although, we often do, as well). 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. >> The semantics are very >> + ;; subtle: see test/automated/bytecomp-tests.el for interesting >> + ;; cases. >> + (setf form (macroexpand form byte-compile-macro-environment)) >> + (if (eq (car-safe form) 'progn) >> + (cons 'progn >> + (mapcar (lambda (subform) >> + (byte-compile-recurse-toplevel >> + subform non-toplevel-case)) >> + (cdr form))) >> + (funcall non-toplevel-case form))) >=20 > `non-toplevel-case' is declared as optional, but here you call it > without ensuring it's non-nil. IOW it shouldn't be optional. Err, yes. >> (defconst byte-compile-initial-macro-environment >> '( >> ;; (byte-compiler-options . (lambda (&rest forms) >> ;; (apply 'byte-compiler-options-handler forms))) >> (declare-function . byte-compile-macroexpand-declare-function) >> (eval-when-compile . (lambda (&rest body) >=20 > Oops, we have a bug here. We should be using `(... ,(lambda ... Well, a minor performance bug. Still worth fixing. --Qssvmuw5m66EJlGkLINlggNFJ7lbDSU3U 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/ iQIcBAEBAgAGBQJTVVjqAAoJEMAaIROpHW7Ip/oQAL2o1SriBvth2JtgU3FJaVTT f5mLgypDbvN66mEZpe5IzQmUobEoRBRWiOR9qRfcA4xTrah83rtG4+fPXhBg19ye x1n2kbWwEXd7iS495C+oGsVYdZ8gJrSoFarfSjxUgs7Qjh7SN5Xa+wodumOsuZKf NSWmn4gnrE4AouIrqgOI9WuoTnYoxU1g5zgGSHutOo3vibHDrX8FbwQEvSH4g67M 7xQSmrOLzVMlLhXGsUwS6ZMEHG+Vu+hhyZGRRaEvWUfExzCNyg8dOFEuDZnm4fzy zOo3+f6BYh7CbtDEbL6XbU+IwCh0CTFdPP1tTrHy6Uxh/8lyIamVIMrAKLFulEyt zFRjZwh1yXE/m10tGTIRG6D2Q9wRDY645S/yL/lbzmi7fgwSKI8jIzpE9icjpoW/ CR6hzpcHpj6UCOvMZx7XKtSA+FQRSldZ/1C8mVvhmtoxKQnrrGGZWzsU4nVBIjGn 3g20khHI9nQItciWICdgPF7DejnFuKDCh4CAtRTAO0cjBtAMNvwc9mAjIMW621CC glV19dhNJJbIM0XXUJxla8kzJwpDpOWPbupOzhDqiUaEZRS1rEIyGgtYTZfmc4mX 2+rgTbAb75+hZxtsTU1q3OZYrbGqJ6sV6IWEEBqKiVvrpIHc8CQTUoSV5WS6yB9Y pKqgCAKmYVAPreBZnq6n =0LZ4 -----END PGP SIGNATURE----- --Qssvmuw5m66EJlGkLINlggNFJ7lbDSU3U--