From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: A combination of defmacro, functionp, and quoted lambdas yields different results on consecutive evaluations Date: Sun, 25 Feb 2018 22:18:01 -0500 Message-ID: References: <08190786-14de-a899-f591-a7043c87bebb@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1519614973 15563 195.159.176.226 (26 Feb 2018 03:16:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Feb 2018 03:16:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: =?windows-1252?Q?Cl=E9ment?= Pit-Claudel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 26 04:16:09 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eq9Gq-0003eh-L2 for ged-emacs-devel@m.gmane.org; Mon, 26 Feb 2018 04:16:08 +0100 Original-Received: from localhost ([::1]:56910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq9Is-0005kO-UL for ged-emacs-devel@m.gmane.org; Sun, 25 Feb 2018 22:18:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq9In-0005k4-1O for emacs-devel@gnu.org; Sun, 25 Feb 2018 22:18:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eq9Ii-00036Y-1e for emacs-devel@gnu.org; Sun, 25 Feb 2018 22:18:08 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:36415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eq9Ih-00036Q-TD for emacs-devel@gnu.org; Sun, 25 Feb 2018 22:18:03 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id w1Q3I2MW027928; Sun, 25 Feb 2018 22:18:02 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id DEC4D603A7; Sun, 25 Feb 2018 22:18:01 -0500 (EST) In-Reply-To: (=?windows-1252?Q?=22Cl=E9ment?= Pit-Claudel"'s message of "Sun, 25 Feb 2018 13:09:51 -0500") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6229=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6229> : inlines <6431> : streams <1780051> : uri <2599415> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:223035 Archived-At: > * In a new file test-macro.el, write this: > > (defmacro mmm (f) > `(function ,f)) > (provide 'test-macro) > > * In a new file test.el, write this > > (with-eval-after-load 'test-macro > (let ((out (mmm (lambda ())))) > (message "with-eval-after-load: %S" out))) > > (load (expand-file-name "test-macro.el")) This is not supposed to work: your test.el uses `mmm` before it gets defined by the subsequent `load`. It's true that Emacs doesn't guarantee that it will always fail to work, but ... you get what you deserve. Stefan PS: BTW, moving the `load` earlier may make it work more often but it still wouldn't make it right. You'd additionally need to replace the `load` by `require` or to wrap it inside a `eval-when-compile`.