From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#27016: possible bug in `defsetf' Date: Tue, 23 May 2017 01:10:09 +0200 Message-ID: <87fufwmqsu.fsf@drachen> References: <87efvgfv4n.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1495494671 10585 195.159.176.226 (22 May 2017 23:11:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 22 May 2017 23:11:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 27016@debbugs.gnu.org, Rafael D Sorkin To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 23 01:11:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1dCwTi-0002dB-AW for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 May 2017 01:11:06 +0200 Original-Received: from localhost ([::1]:45273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCwTn-0001s0-R8 for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 May 2017 19:11:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCwTh-0001rj-S7 for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 19:11:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCwTd-00018Q-V7 for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 19:11:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59000) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCwTd-00018G-Rj for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 19:11:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dCwTd-0004rl-ML for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 19:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 May 2017 23:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27016 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27016-submit@debbugs.gnu.org id=B27016.149549463218649 (code B ref 27016); Mon, 22 May 2017 23:11:01 +0000 Original-Received: (at 27016) by debbugs.gnu.org; 22 May 2017 23:10:32 +0000 Original-Received: from localhost ([127.0.0.1]:33434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCwTA-0004qj-AL for submit@debbugs.gnu.org; Mon, 22 May 2017 19:10:32 -0400 Original-Received: from mout.web.de ([212.227.17.11]:60575) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCwT8-0004qV-Tx for 27016@debbugs.gnu.org; Mon, 22 May 2017 19:10:31 -0400 Original-Received: from drachen.dragon ([94.216.140.150]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MQNma-1dOvPy1quK-00TpZ1; Tue, 23 May 2017 01:10:10 +0200 In-Reply-To: <87efvgfv4n.fsf@users.sourceforge.net> (npostavs's message of "Mon, 22 May 2017 17:18:32 -0400") X-Provags-ID: V03:K0:yYF3cGbMv6YfVxe3YIo8zdDGIp4Zd7kiGTR40/44ECg79Q0DlpX THgBc1EzS/Z1WTwnBK60Ixx0FDQTB064p1uAqqd+t62mPKixCVhAh5TcdPO7bAxZTRu0N37 4u0Vp+zlRIwMRQyaIKuAs8HdCiiHZPu934Stog6nNxe2bfptk9gcPdBSmncCC+hqMrFCy33 TfCcqzPBXd7rsIaqlv9YQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:TsNWpXufLJ4=:a66j1kVxTaRGriDlGEcDih dIRjjiPilZsPGuIbsOgSKj0SufDcVRMd9NpB/g82oabBp4GCW2mT8CmZWxSsd4ThQmm15bRb7 I9aRkHjyRK+NH0IXYa4hjViZqFaQIYXaK8kNacRMhYeI4/LcwN8TdaECJuA4U7aV0ojKZorRY rN8EjsBLIAOY5Y1iOKXtM7XrQgs6CqGyn5h7YXJqVlVc8Ek8Y53m4AyqhZCZjXo5xEw4iU9YD l15LN3K4AiW+LRBee48tG1pzY3hRk7OffrEfJSRBCFoqf+cYABo/JcJQ2Fh8nL00dHsmi5d7Y SlD+gPH9YtYyxBf4KBY5sOrxcyfO+hQgBBx5buQmLzqh6ykRF1DfGehBFYNOekPUGYDMz9SjI SLiFcCpPbjrKNu/HRrBu6mD1K2SIwvA+PXgbEmlSYbUyOpRoaO0eqZt5JvPL0jxyyAheeyskY H2nT0SPizY7XVp/+I1qinXQrODQAxrHe3q9mIAGg7a+RVov3kkRCvLtDpc09CTyphKRF0xPi0 98aIEYNSNwJvBNjoC/hBWFuDvtU77Cw96R0pa67RmEdlTZ5lP04LXwWbaFNUa34rl7Ob/Jjkd VNK22YLt/j0+EOIsaaCXPIUY+LQmJobOD7e86TMXqhaD9cuxsOHlxOWBScEXAyrvuwy2hTSk/ iLsa7WhrU+MY+kcmtXOOXCl2yAejaqjldrUd332Z2IPhItZnsqS0ZjIbOaT7VvUz0XGEG4LNe 4konnpA6hlDbjSgyIGgR4lTVfrNPqiuiDKUhU/eJ3EimnG/Z4ni+1wi1tXoaa2bY3uvFDZiI X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132750 Archived-At: npostavs@users.sourceforge.net writes: > Oh, right, I see it now. It happens in 24.4 and later. I'm not sure > it's a bug though. My guess is that the difference is eager > macroexpansion. When I compile, then I get the same behaviour with 24.3 > (that's my earliest working Emacs build) as well. (require 'cl) (macroexpand-1 (macroexpand-1 (macroexpand-1 '(defsetf foobar setcar)))) ==> #+begin_src emacs-lisp (gv-define-expander foobar (lambda (do &rest args) (gv--defsetter 'foobar (lambda (val &rest args) `(,'setcar ,@args ,val)) do args))) #+end_src A comment in the definition of `gv-define-expander' says: ;; Use eval-and-compile so the method can be used in the same file as it ;; is defined. ;; FIXME: Just like byte-compile-macro-environment, we should have something ;; like byte-compile-symbolprop-environment so as to handle these things ;; cleanly without affecting the running Emacs. Anyway, the above expands to (macroexpand-1 (macroexpand-1 (macroexpand-1 (macroexpand-1 '(defsetf foobar setcar))))) ==> #+begin_src emacs-lisp (eval-and-compile (put 'foobar 'gv-expander (lambda (do &rest args) (gv--defsetter 'foobar (lambda (val &rest args) `(,'setcar ,@args ,val)) do args)))) #+end_src The `put' is evaluated when the `defsetf' macro call is expanded. That's what's causing the issue. AFAIK we don't say that `defsetf' is only allowed at top level, so I would say (without any judgement) that it's a bug. And it's not limited to `defsetf' in "cl". Michael.