From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Rafael D Sorkin Newsgroups: gmane.emacs.bugs Subject: bug#27016: possible bug in `defsetf' Date: Mon, 22 May 2017 18:03:08 -0400 Message-ID: References: Reply-To: Rafael D Sorkin NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1495490653 13063 195.159.176.226 (22 May 2017 22:04:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 22 May 2017 22:04:13 +0000 (UTC) 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 00:04: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 1dCvQs-0003EL-2g for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 May 2017 00:04:06 +0200 Original-Received: from localhost ([::1]:45093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCvQx-0007PM-PF for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 May 2017 18:04:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCvQr-0007PC-O0 for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 18:04:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCvQo-0005mB-C6 for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 18:04:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58937) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCvQo-0005la-52 for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 18:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dCvQn-0003Kx-KQ for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 18:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Rafael D Sorkin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 May 2017 22:04: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.149549059512775 (code B ref 27016); Mon, 22 May 2017 22:04:01 +0000 Original-Received: (at 27016) by debbugs.gnu.org; 22 May 2017 22:03:15 +0000 Original-Received: from localhost ([127.0.0.1]:33381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCvQ3-0003Jz-3k for submit@debbugs.gnu.org; Mon, 22 May 2017 18:03:15 -0400 Original-Received: from mail-qt0-f228.google.com ([209.85.216.228]:36855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCvQ1-0003Jm-8W for 27016@debbugs.gnu.org; Mon, 22 May 2017 18:03:13 -0400 Original-Received: by mail-qt0-f228.google.com with SMTP id r58so17182023qtb.3 for <27016@debbugs.gnu.org>; Mon, 22 May 2017 15:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perimeterinstitute.ca; s=google; h=reply-to:from:to:cc:subject:in-reply-to:message-id:date; bh=CpAoUqANqL4YR3bzD616aqvpLrKW+WZOKrDZd36A9/8=; b=Pk8nMPhDKkMYM9GW+o9Gb7oFSIfsUKByPs5JjVZXDsk1HOTYmxHMeFvkGph/00YUNo +NsVOM3kLXxMhTi4rtg2xsmeu5sT3X6jCfDubDLMnEQw/TRUdEhp19WZw4w1+/so9WXo ubhjUVC7TtwmcpSB4+AO7/UBN+TJE+Co2HQ7w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:from:to:cc:subject:in-reply-to :message-id:date; bh=CpAoUqANqL4YR3bzD616aqvpLrKW+WZOKrDZd36A9/8=; b=uJ4PGTCgSPZQJf44jOvQO1p0t+LKicGDPKsDRe1rtFGdrARQhX2pAc6ImpfQI7ZhSw YjiXZJeT5/6hQkd2fhnBTn8kJoDjbskfPz/rJwyIWjoFGt3jobg/fEtR+o2QVrx/L9md DSW8VVkRe+EIkDXH5n0KH0WbwDfVjh1syRRywX3SaTCPvkLf7jp38Ae9C8etcwLKM3YX JZXJWRjeJFRJAj4mpaSwip39VuLq593FSzbGILVej2Bvy8f2h55n4AmjnTl/qrLz0Lpl ZyMc4axNH6xys6ZfW2VkYC8F926+cBE0rAqRZTeAtN0cPSAQirOlnAyJmrHFN8QzhmhO tFxQ== X-Gm-Message-State: AODbwcCJbGW/M+CfYPizy2Ny6Fy9UhOjnBlUa2rYx0QhTJZdMUQRcGo7 8IYGACsQulBCYqxBn+Pj8pqCoXZ1rfsd3LnHd8Ed X-Received: by 10.36.117.211 with SMTP id y202mr17455999itc.88.1495490587560; Mon, 22 May 2017 15:03:07 -0700 (PDT) Original-Received: from mail.perimeterinstitute.ca ([38.104.158.162]) by smtp-relay.gmail.com with ESMTP id m47sm2472249iti.1.2017.05.22.15.03.07; Mon, 22 May 2017 15:03:07 -0700 (PDT) X-Relaying-Domain: perimeterinstitute.ca Original-Received: from mars.pi.local (mars.pi.local [10.10.7.6]) by mail.perimeterinstitute.ca (Postfix) with ESMTPS id D2401C0025; Mon, 22 May 2017 18:12:11 -0400 (EDT) Original-Received: from rsorkin by mars.pi.local with local (Exim 4.69) (envelope-from ) id 1dCvPw-0002Nz-BU; Mon, 22 May 2017 18:03:08 -0400 X-Mailer: MH-E 8.2; nmh 1.2; GNU Emacs 23.1.1 In-reply-to: your message of Mon, 22 May 2017 17:18:32 -0400 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:132747 Archived-At: Thanks, I was wondering about that myself. Is there a standard for elisp (or common lisp) that would determine whether eager macro expansion is an error in this case? I would expect that a `defun' or `defsetf' etc which is within a conditional would not be executed until it was known whether the condition was satisfied. The opposite behavior seems counter-intuitive to me. But if you decide that this behavior is not a bug, then please let me know, so that I can adapt to it in the future. > tags 27016 - unreproducible > found 27016 24.4 > found 27016 25.2 > quit > > Rafael D Sorkin writes: > > > Following your suggestion I tried starting with "emacs -Q" and > > got the same results as you did. However if I (require 'cl) > > then the bug returns. (I normally require CL automatically on > > starting emacs.) So perhaps it's an incompatibility between CL > > and the new way that defsetf is implemented. > > 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. > > $ emacs -Q -batch -l cl -f batch-byte-compile bug-27016-defsetf.el > > In toplevel form: > bug-27016-defsetf.el:1:1:Warning: cl package required at runtime > bug-27016-defsetf.el:3:1:Warning: global/dynamic var `pair' lacks a prefix > Wrote /home/npostavs/src/emacs/bug-27016-defsetf.elc > $ emacs -Q -batch -l bug-27016-defsetf.elc > pair: (0 . 4) > > where bug-27016-defsetf.el has contents: > > (require 'cl) > > (defvar pair nil) > (setq pair (cons 3 4)) ; (3 . 4) > (unless t > (defalias 'foobar 'cons) > (defsetf foobar setcar)) ; nil > (setf (foobar pair) 0) ; 0 ! > > (message "pair: %S" pair) ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- Rafael Sorkin Perimeter Institute for Theoretical Physics 31 Caroline Street North Waterloo, ON N2L 2Y5 Canada ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-