From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 02:39:43 2017 Received: (at submit) by debbugs.gnu.org; 22 May 2017 06:39:43 +0000 Received: from localhost ([127.0.0.1]:59888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCh0J-00062T-AW for submit@debbugs.gnu.org; Mon, 22 May 2017 02:39:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48155) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCh0H-00062F-5A for submit@debbugs.gnu.org; Mon, 22 May 2017 02:39:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCh0B-0006eY-9q for submit@debbugs.gnu.org; Mon, 22 May 2017 02:39:36 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44117) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dCh0B-0006eO-7S for submit@debbugs.gnu.org; Mon, 22 May 2017 02:39:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCh0A-0000mJ-86 for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 02:39:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCh05-0006cH-D6 for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 02:39:34 -0400 Received: from mail-oi0-x264.google.com ([2607:f8b0:4003:c06::264]:33522) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCh05-0006bs-6j for bug-gnu-emacs@gnu.org; Mon, 22 May 2017 02:39:29 -0400 Received: by mail-oi0-x264.google.com with SMTP id b3so14299168oii.0 for ; Sun, 21 May 2017 23:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perimeterinstitute.ca; s=google; h=reply-to:from:to:cc:subject:message-id:date; bh=+UQOql/50vLc9NY/t44SOA1QWmWG/GNP5y1q413NnLA=; b=FTSBdsMOXn6emgLg0TbWc3toC44E5ifKCscSqiDScPYWfZRz31JPya8HZWF7fPc2t2 kfsi2kkKgpmYHnMtF9xjLR7tXNRuOttyDD0G4t7TuLovxEsd9K1h7pztOJ+E73fQdKrN xwAHLhO/NOakYZTvjGkOEM3fi5SVM3T6WV2lM= 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:message-id:date; bh=+UQOql/50vLc9NY/t44SOA1QWmWG/GNP5y1q413NnLA=; b=oOU2P1ofMCiWzL2bbchfrx6HgUwWNr1BaYibsHwC2FH+smiFAHc+Dk864Lv/vEvQn2 WJagu1TUOkj2JPbZmJkwFLBsYGKOrD73yEB9bWdwQFva5ywyeToYjjAVq266jjIM4ugf c7h2EjSqm3Q7nukJWaRRaekiIzV58mBo+j33rA6tkDrI6GiRvYvVrlXMP3Jpxd+vgD7F i2FBBQRxSWJ3kxbKDa2UeQrJAEbjlGmk7DqQvOFgMIsjwqUulBHRsuLV1M/AGAZYKrBG SeiLN/YUbr5eh8Dt+zwAMBhzSrxMuV/KGzwMI+yodsVLj281l5x36dSoilUr0WxebDwW dPQA== X-Gm-Message-State: AODbwcCG2TXq/Nyrl5+dqTnYyjQXMSsaFQo7+dscd0FnSvNLvi0+qWI/ X6MQ96rRdsIDieWlV1v8YTTwx4K45RCfGNg+UGjw X-Received: by 10.36.203.132 with SMTP id u126mr37947287itg.11.1495435167999; Sun, 21 May 2017 23:39:27 -0700 (PDT) Received: from mail.perimeterinstitute.ca ([38.104.158.162]) by smtp-relay.gmail.com with ESMTP id f13sm10664907itb.5.2017.05.21.23.39.27; Sun, 21 May 2017 23:39:27 -0700 (PDT) X-Relaying-Domain: perimeterinstitute.ca Received: from mars.pi.local (mars.pi.local [10.10.7.6]) by mail.perimeterinstitute.ca (Postfix) with ESMTPS id B5718C0051; Mon, 22 May 2017 02:48:28 -0400 (EDT) Received: from rsorkin by mars.pi.local with local (Exim 4.69) (envelope-from ) id 1dCh04-0001Bd-Ec; Mon, 22 May 2017 02:39:28 -0400 From: Rafael D Sorkin To: bug-gnu-emacs@gnu.org Subject: possible bug in `defsetf' X-Mailer: MH-E 8.2; nmh 1.2; GNU Emacs 23.1.1 Message-Id: Date: Mon, 22 May 2017 02:39:28 -0400 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Rafael D Sorkin Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hi, The second behavior below seems like a bug to me. It was not present in emacs 23.1 Best wishes, Rafael Sorkin emacs-version ; 23.1.1 (setq pair (cons 3 4)) ; (3 . 4) (foobar pair) ; Symbol's function definition is void: foobar (setf (foobar pair) 0) ; No setf-method known for foobar (unless t (defalias 'foobar 'cons) (defsetf foobar setcar)) ; nil (foobar pair) ; same as above (setf (foobar pair) 0) ; same as above pair ; (3 . 4) emacs-version ; 24.5.1 (setq pair (cons 3 4)) ; (3 . 4) (foobar pair) ; Symbol's function definition is void: foobar (setf (foobar pair) 0) ; (foobar pair) is not a valid place expression (unless t (defalias 'foobar 'cons) (defsetf foobar setcar)) ; nil (foobar pair) ; same as above (setf (foobar pair) 0) ; 0 ! pair ; (0 . 4) ! ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- Rafael Sorkin Perimeter Institute for Theoretical Physics 31 Caroline Street North Waterloo, ON N2L 2Y5 Canada ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 08:09:55 2017 Received: (at 27016) by debbugs.gnu.org; 22 May 2017 12:09:56 +0000 Received: from localhost ([127.0.0.1]:60098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCm9r-0007GM-Oc for submit@debbugs.gnu.org; Mon, 22 May 2017 08:09:55 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:38464) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCm9q-0007G4-5S; Mon, 22 May 2017 08:09:54 -0400 Received: by mail-it0-f51.google.com with SMTP id r63so21641216itc.1; Mon, 22 May 2017 05:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XZugcra421JyI+gbRKO3uOrHujU4jQJbyaWqY6vY60s=; b=mVI3gQQbWoX6bYQ0X051IouxI/fm1Qn3bqjYJOJoC8lPt/z1lU/YH+VAaomaBaGwXW jnqI3bCGY25Z5UpvIoQ/WzHA45hpM5BSjSW5LlDvngRS8BoUVRjgteHvkERefPugbQ2n xbe2jFweEbOuU51PS0XdPWIio9pIElSOszKJ6CZbzJFYzW9gqUuuXMy2kQG3GQ71JK7z uFpx2ld26HuFLG92VWm0UVA63NlVvytZPwqBf7aa+6viupPQI/JQZQcjmiPIf/fxnqOx EDyIaab6ek95DZmMx4+03JWDdHx9yzjRY7fkAVsPKUO9nQL9fWYyVXqBTrfMGROzRUzM s15Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=XZugcra421JyI+gbRKO3uOrHujU4jQJbyaWqY6vY60s=; b=Pn79Blg4HA6xt1l3nC/pj4YeiqT3dp4UjAVX+wL1DATIKJpvuQwqCGhQlSUI5SKgQn jJwjp0Jvv34M8+ZDv3vIcbqEahT926ouJVTrezACR6eps7id2WlsvW5LqtquafIoYuW+ JBVZvlKwXMoGg7sDF/H1NRgsIbSp97WB6W9Om/D8WTh/jHnVxLvdL7LYJDCoEBE49tOz be0hdAT/iK4mNclgPsdJwyCsQ2k32VyRWYlT7IVlH7rK7QqowfJEItui6N1u2BvYxr8L SNFzKvCI4sufIRb6DnJvaOvSD321JqhAVW8GCeoy6jxSabDoJuzeaqXXxQoW+h2eb9vO b9gw== X-Gm-Message-State: AODbwcAkI+uo4oW4l4nGZYdWS296XX4HEU+3N/bW+v/0mwnMeFLjtkzk 6MghSKVTPU02ag== X-Received: by 10.36.33.142 with SMTP id e136mr39304669ita.72.1495454988574; Mon, 22 May 2017 05:09:48 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id y87sm35407ita.17.2017.05.22.05.09.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 May 2017 05:09:47 -0700 (PDT) From: npostavs@users.sourceforge.net To: Rafael D Sorkin Subject: Re: bug#27016: possible bug in `defsetf' References: Date: Mon, 22 May 2017 08:11:25 -0400 In-Reply-To: (Rafael D. Sorkin's message of "Mon, 22 May 2017 02:39:28 -0400") Message-ID: <87mva5f5w2.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) tags 27016 unreproducible quit Rafael D Sorkin writes: > emacs-version ; 24.5.1 > (setq pair (cons 3 4)) ; (3 . 4) > (foobar pair) ; Symbol's function definition is void: foobar > (setf (foobar pair) 0) ; (foobar pair) is not a valid place expression > (unless t > (defalias 'foobar 'cons) > (defsetf foobar setcar)) ; nil > (foobar pair) ; same as above > (setf (foobar pair) 0) ; 0 ! > pair ; (0 . 4) ! I'm not able to reproduce this behaviour on 24.5, the second setf throws an error just like the first. How are you evaluating these exactly (starting from emacs -Q)? I tried C-x C-e on each sexp in turn. From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 16:25:21 2017 Received: (at 27016) by debbugs.gnu.org; 22 May 2017 20:25:21 +0000 Received: from localhost ([127.0.0.1]:33288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCttJ-0005t7-DJ for submit@debbugs.gnu.org; Mon, 22 May 2017 16:25:21 -0400 Received: from mail-oi0-f100.google.com ([209.85.218.100]:32931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCttH-0005st-Fk for 27016@debbugs.gnu.org; Mon, 22 May 2017 16:25:20 -0400 Received: by mail-oi0-f100.google.com with SMTP id b3so16107492oii.0 for <27016@debbugs.gnu.org>; Mon, 22 May 2017 13:25:19 -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=z4CB1gigW915eEo67EyQTav9RldBE+4l8Qrv5sT/y84=; b=SSfrPZvSR4HWp2vwg41kPSUGPL1TjRLf5Ofj/VJj9Rv//HozZHJimOgqoTvC3khUpD +cpCVXPe04ipQhpG3ggKFOMSoSue8vJ8eiRYG9O58kkaZv5ZsOc1dybwr/gx26F6CLxs jdGMr0JnYqHY+YJKZocBpPTNhR5GuLI1D3oGY= 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=z4CB1gigW915eEo67EyQTav9RldBE+4l8Qrv5sT/y84=; b=Um5wTTiUgI6F+t1cu7l4FtMHVECYE74/m+d9Z99Oes0JPvHcRuQDyCwEvky4kRNxka +fZ9nnt7oTJNzq8l6x1sQGMOrkmRxGApFObeQjBHci7odC2KXmAWDi0r51wUW4nptupS 58crtNaw16g1zrBAyBod8RhryHN0cqqYVpf9dTYC9Ns3LfaKTjN+TYzfT8wnGs9LxWcl bLxPdfemkYjtFyawkwm2NCRSLraDIjUNp1PZCQaL1mPzxNlnQaHJ+g8hRMJktmCSsbPf 8dWSfZ5yKAo50mRdCRED390DhMxv3QiEcB9PhsebZvmxRESr5ves0URl5RgmnaiFM8ej jknA== X-Gm-Message-State: AODbwcCD6YwI5wx2XxkgQom/IzhgKnni9G5XDQx4oqGuCvbzWK6UtHD0 J1aFqIbG38wS9ExPTEnFGYwY7qpSGOt6h41WJ8o2 X-Received: by 10.36.12.141 with SMTP id 135mr41004121itn.89.1495484713730; Mon, 22 May 2017 13:25:13 -0700 (PDT) Received: from mail.perimeterinstitute.ca ([38.104.158.162]) by smtp-relay.gmail.com with ESMTP id o184sm6433894ito.2.2017.05.22.13.25.13; Mon, 22 May 2017 13:25:13 -0700 (PDT) X-Relaying-Domain: perimeterinstitute.ca Received: from mars.pi.local (mars.pi.local [10.10.7.6]) by mail.perimeterinstitute.ca (Postfix) with ESMTPS id CD34AC0025; Mon, 22 May 2017 16:34:17 -0400 (EDT) Received: from rsorkin by mars.pi.local with local (Exim 4.69) (envelope-from ) id 1dCttC-0001tS-OZ; Mon, 22 May 2017 16:25:14 -0400 From: Rafael D Sorkin To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' X-Mailer: MH-E 8.2; nmh 1.2; GNU Emacs 23.1.1 In-reply-to: your message of Mon, 22 May 2017 08:11:25 -0400 Message-Id: Date: Mon, 22 May 2017 16:25:14 -0400 X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Rafael D Sorkin Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) Hi Noam, 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. - Rafael > Sender: Noam Postavsky > From: npostavs@users.sourceforge.net > To: Rafael D Sorkin > Cc: 27016@debbugs.gnu.org > Subject: Re: bug#27016: possible bug in `defsetf' > Date: Mon, 22 May 2017 08:11:25 -0400 > In-Reply-To: (Rafael D. Sorkin's message of > "Mon, 22 May 2017 02:39:28 -0400") > User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) > > tags 27016 unreproducible > quit > > Rafael D Sorkin writes: > > > emacs-version ; 24.5.1 > > (setq pair (cons 3 4)) ; (3 . 4) > > (foobar pair) ; Symbol's function definition is void: foobar > > (setf (foobar pair) 0) ; (foobar pair) is not a valid place expression > > (unless t > > (defalias 'foobar 'cons) > > (defsetf foobar setcar)) ; nil > > (foobar pair) ; same as above > > (setf (foobar pair) 0) ; 0 ! > > pair ; (0 . 4) ! > > I'm not able to reproduce this behaviour on 24.5, the second setf throws > an error just like the first. How are you evaluating these exactly > (starting from emacs -Q)? I tried C-x C-e on each sexp in turn. ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- Rafael Sorkin Perimeter Institute for Theoretical Physics 31 Caroline Street North Waterloo, ON N2L 2Y5 Canada ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 17:17:03 2017 Received: (at 27016) by debbugs.gnu.org; 22 May 2017 21:17:03 +0000 Received: from localhost ([127.0.0.1]:33333 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCuhL-00075r-6J for submit@debbugs.gnu.org; Mon, 22 May 2017 17:17:03 -0400 Received: from mail-it0-f54.google.com ([209.85.214.54]:38384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCuhI-000759-VK; Mon, 22 May 2017 17:17:01 -0400 Received: by mail-it0-f54.google.com with SMTP id r63so5901739itc.1; Mon, 22 May 2017 14:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=M98C3Yy88Y40uot4zEYCc91cquWaaA4wSHuFkMsanL0=; b=C3LHelXtVLScS/Q71NJt1yy2HraVsO4knmopg6kdlk/Fc7oUjEBYVS0Y373XpK1J5C 7yOBPFol8GaGKv1IiPU3OrM9ZuI5K7O+x1wgxC9jUmpLKmXRIBlwS5g46W/QzoZsvM6H Te4Vnw3IyA8kSavbZvqxpVpHwYFyQlswsfcv+maYH3KcS7gkGCN8m7/F+q8//yeTgrUr H9q1OtsJpFUZDaSXRw/At9GgKKPfbMQF+J0ht7HxE0D/a3/eOvlVVeAP6eknQ2gP0CrY B+OcCV9Kf/aeGBwM+Cf0mJCbL+J8DbzBw/IfWejZ3MrBixFwxsWoXIlCniwCd+bmRfPZ KAcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=M98C3Yy88Y40uot4zEYCc91cquWaaA4wSHuFkMsanL0=; b=sUrMsmcRqSL+v0GoaGCNBi3HGKFzzljBzNeWpVPVWCy4xQ6zJAm8qwdAzuWTOd3qOP msvHAp11wTsi30hr3VUPb1p6D2WhmkOIOPPwvzSFOC2KjgbYbtJhCcADH2hyRvVPtph6 bKj4ViyPERthLKDHt1Z9gjz+nPmZJnIZYXk+W4mXEvfS4XZL4t9GZ4Vzuw0mYky2W0vP rZimzuZi4u4F3L7jjLS4ORToS0JGNW95Kx5MdJdDpZ5+VpxoB+TgouqLZcoHw3RP6V96 43u004UINxAdaprRyurogFdIOoe52Zj0/wLk4NgjnLDynQqbI+DKvKUeHtYkroqkfnjo RizA== X-Gm-Message-State: AODbwcDZF9w5NRtIwWsaebK4mE7R91ic+XduGHRb45E/BJ1OYeExALRa 4RMDwV91eQyOQw== X-Received: by 10.107.146.68 with SMTP id u65mr10624575iod.154.1495487815149; Mon, 22 May 2017 14:16:55 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id e34sm7885564iod.18.2017.05.22.14.16.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 May 2017 14:16:54 -0700 (PDT) From: npostavs@users.sourceforge.net To: Rafael D Sorkin Subject: Re: bug#27016: possible bug in `defsetf' References: Date: Mon, 22 May 2017 17:18:32 -0400 In-Reply-To: (Rafael D. Sorkin's message of "Mon, 22 May 2017 16:25:14 -0400") Message-ID: <87efvgfv4n.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 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) From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 18:03:15 2017 Received: (at 27016) by debbugs.gnu.org; 22 May 2017 22:03:15 +0000 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 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 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) 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 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) 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 From: Rafael D Sorkin To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' 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 Message-Id: Date: Mon, 22 May 2017 18:03:08 -0400 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Rafael D Sorkin Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 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 ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 19:10:32 2017 Received: (at 27016) by debbugs.gnu.org; 22 May 2017 23:10:32 +0000 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 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 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 From: Michael Heerdegen To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' References: <87efvgfv4n.fsf@users.sourceforge.net> Date: Tue, 23 May 2017 01:10:09 +0200 In-Reply-To: <87efvgfv4n.fsf@users.sourceforge.net> (npostavs's message of "Mon, 22 May 2017 17:18:32 -0400") Message-ID: <87fufwmqsu.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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+1wi1tXoaa2bY3uvFDZiI1 1FNqgmK X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 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. From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 19:14:27 2017 Received: (at 27016) by debbugs.gnu.org; 22 May 2017 23:14:27 +0000 Received: from localhost ([127.0.0.1]:33455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCwWw-0004xD-Ng for submit@debbugs.gnu.org; Mon, 22 May 2017 19:14:26 -0400 Received: from mail-it0-f54.google.com ([209.85.214.54]:37798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCwWv-0004x0-8N for 27016@debbugs.gnu.org; Mon, 22 May 2017 19:14:25 -0400 Received: by mail-it0-f54.google.com with SMTP id g126so8514618ith.0 for <27016@debbugs.gnu.org>; Mon, 22 May 2017 16:14:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=JdjwtOZGo8cIFHTpB0zB3atQ+kxbfS6bj0mpfVWD4so=; b=aqBHg2VcKaiU3+6ybPxlldw5nCwJmKBetDnQxfGR4aQ9+SfFELx9AS1Dypghd3uqC+ fmrWYgCkVfuBjgMjbdEJa6q7jLfczjjQyPe+3covO9H+pjEDdKzqpDi8pjIT09PeiFyv GFdHOYjsE3Lx831zWCX4/MNhiBDDEKRn9iIgmyGXFbDECsxbp+jiKhRA0XruNtJv66HY f2xNtwL5vhwfkJw7OxMei5aMCOJInNM6Hhx+qOjmiDlAWNkt+H1HDRr8vaFKmaU9+YhM L7i3lV+BY7IhyRxAolUGoX80A6M4yo1xXIlIlOeqdcOz9XUWHDJYGDoKiJMyAUoOxOPE /BcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=JdjwtOZGo8cIFHTpB0zB3atQ+kxbfS6bj0mpfVWD4so=; b=oFit/xZwUwrGvwDlUhdjrz9fIdfVeLfC1zq2kzxrfUuYqXSecZK8brzpPuhG045LM/ +i7Tz512cs1zH8vJQvcDoD6C1wNV5GpTXE5G+es+5BLNWUmYhSjN8cU8uzn+43FKYTnK t7C2fLFFSaCpJIcfhXdpejI6DplJT8nxerhCM1F+ds59UMfKIGCudAp87WzLuvsQltfj eCx6x2pPR2m5OJG5QhxlXXTRFaXYSVuV+If8Dhs4JCGlruihHlMjn6mMdwkFPXCEw2C5 kXsJRDPam1bmGoSFesyPlONBiSgGJRqnCVi677HlTtYO382xF1LeTOigU6LQgWpY0hqk /ZpA== X-Gm-Message-State: AODbwcBvL9L8HLPWutUK+tdn35ab+flT/a5YZ6VObklpR2nXqqvHTlCd fY1JvzWLruc4mw== X-Received: by 10.107.23.66 with SMTP id 63mr23708143iox.184.1495494859481; Mon, 22 May 2017 16:14:19 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id b10sm8287014iod.33.2017.05.22.16.14.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 May 2017 16:14:18 -0700 (PDT) From: npostavs@users.sourceforge.net To: Rafael D Sorkin Subject: Re: bug#27016: possible bug in `defsetf' References: Date: Mon, 22 May 2017 19:15:57 -0400 In-Reply-To: (Rafael D. Sorkin's message of "Mon, 22 May 2017 18:03:08 -0400") Message-ID: <87a864fpoy.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Rafael D Sorkin writes: > 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? CLTL says this[1]: The evaluator is typically implemented as an interpreter that traverses the given form recursively, performing each step of the computation as it goes. An interpretive implementation is not required, however. A permissible alternative approach is for the evaluator first to completely compile the form into machine-executable code and then invoke the resulting code. This technique virtually eliminates incompatibilities between interpreted and compiled code but also renders the evalhook mechanism relatively useless. Various mixed strategies are also possible. All of these approaches should produce the same results when executing a correct program but may produce different results for incorrect programs. For example, the approaches may differ as to when macro calls are expanded; macro definitions should not depend on the time at which they are expanded. Implementors should document the evaluation strategy for each implementation. and this[2] specifically about defsetf: X3J13 voted in March 1989 (DEFINING-MACROS-NON-TOP-LEVEL) to clarify that, while defining forms normally appear at top level, it is meaningful to place them in non-top-level contexts; the complex form of defsetf must define the expander function within the enclosing lexical environment, not within the global environment. I'm not sure whether (unless ...) counts as an "enclosing lexical environment" though. > 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. `defun' takes effect at runtime (or rather it expands to `defalias' which operates at runtime), whereas `defsetf' has to affect subsequent compilation, so waiting until runtime to decide whether the condition is true could not really work. > 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. I *think* it's not a bug, or at least not one worth fixing. If you wrap your (unless ...) form in (eval-when-compile ...) then you get your expected behaviour. [1]: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node179.html [2]: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node80.html From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 19:21:40 2017 Received: (at 27016) by debbugs.gnu.org; 22 May 2017 23:21:41 +0000 Received: from localhost ([127.0.0.1]:33462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCwdv-000588-J3 for submit@debbugs.gnu.org; Mon, 22 May 2017 19:21:40 -0400 Received: from mail-it0-f53.google.com ([209.85.214.53]:38516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCwdu-00057v-9I for 27016@debbugs.gnu.org; Mon, 22 May 2017 19:21:38 -0400 Received: by mail-it0-f53.google.com with SMTP id r63so8624108itc.1 for <27016@debbugs.gnu.org>; Mon, 22 May 2017 16:21:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=mn3MW65ShLVKQpjYuUzBkmEfIhEsnrJdTFdBMBc49rg=; b=uDD0iNWf8JXmmQ44irOUC8wyrn5a8q8u6Ow7I5c9seYyyb26VKc2PCkdY5p6qhPJt3 jdkLHKnX3DlbHI91qYEl2tfsSopacJbGaX/8avDOrUxGZxpQRhOt2LlAjpmTAuvqQ5cB XXEajwBNgZ/bkGX8cPks1SaQ240c2l1eK6HkV6LySGCO1W8Sz5nPFQtnk6QFHcGhYgSR 79FVKPTIEMkeg66RPcmtxykLSGQyVlB8YNnyQux8+0oT45lEhD8PrbceFk0KWOfZBsAO vkQ8z+Z77iAwWJXWRIyf2/LcfzPgC//msA5eiDFnkfDF7W5l2xAm4fDkJtJDGphZJ+dO jjOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=mn3MW65ShLVKQpjYuUzBkmEfIhEsnrJdTFdBMBc49rg=; b=qKgnpc8ngW8ABFw/gPxbylnckn+lYwTY98MDqEZasYfqX3CiKF+18r1I0qLr8hwOK6 y9RmUJ7T78zscy32W39JHDWutTp057Msxa5ojgGjZZd1cIL6w22WHWP5fTRyexDZe8Eb qUUfozEBDONeShzZSRBDOqCw5UTkyjQaO2YE6Ju7ZT0NWqYGRxfAbAFZ9jDCbMpwPKAP me+vXQnvKeu/8qYDR2mnMcAGnKO46SLxP8PzeCR/fbmZQwAc8oUiRvl0m1EHF1T90LSX o8xThqg7jWqlLBWVBvvT+FPDFrv97C7lbbjo4K2wrs1vtv8jzIj0Tbdth0sPK6tKSUc5 UDcA== X-Gm-Message-State: AODbwcClkB2qEhflVZrYr6tGrQuYjKvhvxAXpOiEACXPasV8QUn7vsq3 i1QxRFCTc31QOw== X-Received: by 10.107.30.213 with SMTP id e204mr1289837ioe.158.1495495292778; Mon, 22 May 2017 16:21:32 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id n14sm3418382itg.0.2017.05.22.16.21.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 May 2017 16:21:32 -0700 (PDT) From: npostavs@users.sourceforge.net To: Michael Heerdegen Subject: Re: bug#27016: possible bug in `defsetf' References: <87efvgfv4n.fsf@users.sourceforge.net> <87fufwmqsu.fsf@drachen> Date: Mon, 22 May 2017 19:23:10 -0400 In-Reply-To: <87fufwmqsu.fsf@drachen> (Michael Heerdegen's message of "Tue, 23 May 2017 01:10:09 +0200") Message-ID: <877f18fpcx.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Michael Heerdegen writes: > 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. I think fixing that would not fix this bug, because the (setf (foobar pair) 0) would still be compiled according to byte-compile-symbolprop-environment. It would just mean that compiling the file containing (defsetf foobar setcar) would not affect other files in the compiler's session. From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 20:45:51 2017 Received: (at 27016) by debbugs.gnu.org; 23 May 2017 00:45:51 +0000 Received: from localhost ([127.0.0.1]:33504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCxxP-00072b-4z for submit@debbugs.gnu.org; Mon, 22 May 2017 20:45:51 -0400 Received: from mout.web.de ([212.227.15.3]:52531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCxxO-00072P-08 for 27016@debbugs.gnu.org; Mon, 22 May 2017 20:45:50 -0400 Received: from drachen.dragon ([94.216.140.150]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MFeoH-1d9RJF21HZ-00EdeC; Tue, 23 May 2017 02:45:28 +0200 From: Michael Heerdegen To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' References: <87efvgfv4n.fsf@users.sourceforge.net> <87fufwmqsu.fsf@drachen> <877f18fpcx.fsf@users.sourceforge.net> Date: Tue, 23 May 2017 02:45:27 +0200 In-Reply-To: <877f18fpcx.fsf@users.sourceforge.net> (npostavs's message of "Mon, 22 May 2017 19:23:10 -0400") Message-ID: <87d1b04d08.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:7R27tGSSsScz2f7lphPEGIXKMX5kQLkgp1QGQBkeThciWVaCrac 1Oz14qL8Kbr6DIlv1pNlXRvudYd2fuAjonELjdKDH/ex8lD1TroneQuEvTbREqd+2kB7uOR wN7OKBMoewNzPSsSHJT9naxVZuCPcbcVFNMf4e0evOHzFsFFTANXsMJqjdNJc69QDHZNg5C oEqXcsdviapwTj+X37/dw== X-UI-Out-Filterresults: notjunk:1;V01:K0:1AtnXyUd2i8=:HzZdCAC3lh7j4W0NDVYeqB nmxIP7l/RSETN/lOWILI5u2ekVCD0D9hHNe7NJ5OXGNlsDpfbDgeJv6J89Y87hsfeVBpcmWdD yPNj2k/m2f02cwMSyLcrlCjCvj4C8tpXXFfToiKlYnbZR1PL2aTgfk+x/oZLjEidWDs2gc1Gg hNLJqQ9MAPk0da6/iF6y3r9mFeLHezVVlAY0hW00Z8+DmJkN/18CvuiL4p6lkTrckoGDS2w6J yRpknJzhBDgiWz6MyecHlCOzBI5qOCdCpvVB9Oih0MOhCnFJtTpZu182oNKBjZuHYofUtK9/Z X5pe9zfzylDFG33P/Bmnuur9XMNL39F81/Df3Y5RT1d1oBqaaDcP0D+t3bKbeZDpYDNJ+pvp6 mpGHE+TsRYFjEVAvRVvQ6L9MXllo+JQPVEQAtlVqFYiKI6WFg+Od9NZkR7JGyL05KuDND7kRT +90vdYJ6DrCpa5GLkP+/2wDLTfWvGQ2f5iD+kSaRzxMPZD8uf3W0ORQBZJxzIe12/2E0xFQwR 726xaEGXzIlMvEAmG208xGyqyUCPs8TqkEZgx+PBkY1kl8jw7JYVUJH4fOCMVjBy8omlAVay2 GKDcQPmtO0qrPdwudL8medZE3mvpzL6+G1jsEIirsjQWtGPAzBHLUUBxEsiODlpxGBit2WsaI AsIXvjxq3pcXfAmYsfQkYDh1oEyb3wKNOK5RcRjIkvsSMGBRwmP0BqyPHV/fMXeWErzoQys4v 5ojhxuoMAuLn5rI5asdzKMW5SmNwLOiY7OXUU7vx14hYKXjnAj3NqGi0GKqkWV2SdRGY/m8Xa 2o6b7x+ X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) npostavs@users.sourceforge.net writes: > I think fixing that would not fix this bug, because the (setf (foobar > pair) 0) would still be compiled according to > byte-compile-symbolprop-environment. It would just mean that compiling > the file containing (defsetf foobar setcar) would not affect other files > in the compiler's session. Yes, there is probably no reasonable backward-compatible fix at all. Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 20:50:25 2017 Received: (at 27016) by debbugs.gnu.org; 23 May 2017 00:50:25 +0000 Received: from localhost ([127.0.0.1]:33519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCy1p-0007AC-Ir for submit@debbugs.gnu.org; Mon, 22 May 2017 20:50:25 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:36570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCy1p-0007A0-0y for 27016@debbugs.gnu.org; Mon, 22 May 2017 20:50:25 -0400 Received: by mail-it0-f67.google.com with SMTP id i206so13423046ita.3 for <27016@debbugs.gnu.org>; Mon, 22 May 2017 17:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=JgMugrqcdszBroep6KpOg8pSm1/IrSRFKGhRBbx8CVA=; b=NIoX9o5o2tvw5f0oBHrdPtGjjjoYQNgZOVKQId4NneySXiBEyfpUmTiVd8HmcvzkVW lcArOq4QGqhQVMbvEjwIWzhAfcvAKbwjLtFaK8hjrmx+CnmFBCKvHi1vUtxkfz3hoMkg MqgO2+d15oIk7pYc2bY/46pamWWk5Pac2XXHlXZK8ZRaL+wWxkvl6/Rv7Y1/ohpQVXlY oDOxxCFFtHakzYKF6pW0qzyUwN6Gd3oeVsS4W+27Thxgd/JiY4QsccM5L6IetY3wzzqr Tm0oT4DjaZPIiZGEsxGDBoqbRiydVArrA4kdtT+coYwzL/OxiDPivfayGhK8eV+X6S6U DRkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=JgMugrqcdszBroep6KpOg8pSm1/IrSRFKGhRBbx8CVA=; b=HF3hvG/8CX5E7rLAO3XeKv4x9mKvbpv4lzXtNYrQQLphGaD4cwl2oeh3K2fr+tGJHM 9Fdi32/NszSGV+rSoHhHMFtkFjo488UslM0BCd/jTP7STHTarQu9NosCDOVFWPEmR+u+ XbtJNEmAkvWA4mRmWCp/rnrXQQ5Ba1aQHngk4DD9mBLtYoYAaIiR17Z1AydQT5t/7sHQ xF19vMwzzVwHsvyvzoofn27HQAPAzl7QxbO3vBm9zrzmxHLjAs/njh/lsG2v+ikb15I0 fqfaYzH2OZapOottP6ikK5OUwHoq/IaPQCPWJ2qpxXW4MUgiBe0wkSUcr0IgX5PBfUXP FJFw== X-Gm-Message-State: AODbwcBJv8277Ex/DJutEk+RTWgzn+gXYQpYlax33JUBWuqu5KakyQaJ haHtMBWiAD8U3Q== X-Received: by 10.36.65.68 with SMTP id x65mr397635ita.121.1495500619440; Mon, 22 May 2017 17:50:19 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id i28sm8391004ioo.54.2017.05.22.17.50.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 May 2017 17:50:18 -0700 (PDT) From: npostavs@users.sourceforge.net To: Michael Heerdegen Subject: Re: bug#27016: possible bug in `defsetf' References: <87efvgfv4n.fsf@users.sourceforge.net> <87fufwmqsu.fsf@drachen> <877f18fpcx.fsf@users.sourceforge.net> <87d1b04d08.fsf@drachen> Date: Mon, 22 May 2017 20:51:56 -0400 In-Reply-To: <87d1b04d08.fsf@drachen> (Michael Heerdegen's message of "Tue, 23 May 2017 02:45:27 +0200") Message-ID: <87zie4e6oj.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Michael Heerdegen writes: > > Yes, there is probably no reasonable backward-compatible fix at all. Apologies if I'm misreading you, but do you have a non backwards-compatible fix in mind? Because I don't see one of those either. From debbugs-submit-bounces@debbugs.gnu.org Mon May 22 21:18:28 2017 Received: (at 27016) by debbugs.gnu.org; 23 May 2017 01:18:29 +0000 Received: from localhost ([127.0.0.1]:33543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCySy-0007ns-NP for submit@debbugs.gnu.org; Mon, 22 May 2017 21:18:28 -0400 Received: from mout.web.de ([212.227.15.14]:54112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCySw-0007nd-VA for 27016@debbugs.gnu.org; Mon, 22 May 2017 21:18:27 -0400 Received: from drachen.dragon ([94.216.140.150]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LotIZ-1dron7356h-00gmIu; Tue, 23 May 2017 03:18:06 +0200 From: Michael Heerdegen To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' References: <87efvgfv4n.fsf@users.sourceforge.net> <87fufwmqsu.fsf@drachen> <877f18fpcx.fsf@users.sourceforge.net> <87d1b04d08.fsf@drachen> <87zie4e6oj.fsf@users.sourceforge.net> Date: Tue, 23 May 2017 03:18:05 +0200 In-Reply-To: <87zie4e6oj.fsf@users.sourceforge.net> (npostavs's message of "Mon, 22 May 2017 20:51:56 -0400") Message-ID: <8737bwl6b6.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:6oOP3963u6Gg3VVx/yio/sLxqQybaJxFja6WbKNHdmyWoHmeHZ2 EcTt9s8EtZxJsHqRykzwYpMOqQ/fNf54xyeSY8Yix3NRHI8pxUwiKckLQ7EvPoQq8bywJ0v 7gPc/hlj33aWJl7rqMa3jV4BPD9dfRruDITtQmjvbdsh0g3uTuS7joGs1M9sY+I7A4x7la1 1XbgALRon3YYSRNj9qjLQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:pgBfZOwJuA4=:HDh41a071JRZW18MmPdD0i EOVWdOV2RlmImmPoxdG6ADUqILxAAthIszWmeo0AcCkPcelV+XJtLhlYYIaDX7aIdUDYmwz3I W40ap12nHwRE0Ze43edK3jrHqMDgfAuG3g4w3AmNHZeJmHT7FXuymS0xkOBd+ctvMZ2yBdRWm TXHp+Cf9zoHlHlb6aWCXw3588Br+a53q3LSYBR00g2ns23oZhzKugmlSScdfnyy/hktt4qAS4 1W2VoDCFP+kUXaFaquD49DDkwcQjwid6ELK4oUKYlbHeQOOAqjqY2+wOL/XV0RICr3b2/9W5O Qfo+IJKSF8UiGxsCX58vk/nCVsi0h4Qa6svHGo+UQcNhSGkhVQlj/HQEgQHxEyh2BJ8MUCYxo ZHpSv3iZSyjL/8LQNAEkOJmzIBaomXNsy5qVi5cUpWSfriwvN7jappcP/Bzw+ovqxPxnR/f0U K97NGS6uxUL7maYdd1rRfW2pa7kGpCZa20ZdD55AjqWXrerOq7PEb9zITQUKFOpgSe34kB3A/ vwXsRJkvhv3jlLo6h8qqTXgm3r4bnrXCViBo310FuAwvcVFJuZarhPTiHr17tZ6j0cZHReLiZ 0lEC+zpc2boZRC+BmhC1oZMNoWzx5QTLs4B/TRicJMD8vDwu9thP95D4Pq6BCMHRqWm83XMlS byP2+6yrvOC7LfORsSAdP/OJ9ZwK5nBB8V8skJu4xYbKUhVPi4s1DEBA7LaGRocBtkmX09mP4 oEzCgSNFfNtzwcb5/fAbWMdl1Hp+WCjPd4EnBz7hij8tl4bjP0MSN8BdTyeCNq+Y1nf4HVTSp Q4/qHi8 X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.5 (---) npostavs@users.sourceforge.net writes: > Apologies if I'm misreading you, but do you have a non > backwards-compatible fix in mind? Because I don't see one of those > either. I wondered whether we could handle top-level setter definitions specially (i.e. like now) and give up the magic for the rest. But that's probably a too drastic change, and I'm not sure if it would be a good change either. Michael. From debbugs-submit-bounces@debbugs.gnu.org Wed May 24 00:52:40 2017 Received: (at 27016) by debbugs.gnu.org; 24 May 2017 04:52:40 +0000 Received: from localhost ([127.0.0.1]:35381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDOHo-0003QU-LB for submit@debbugs.gnu.org; Wed, 24 May 2017 00:52:40 -0400 Received: from mail-qt0-f225.google.com ([209.85.216.225]:35250) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDOHm-0003QH-Mb for 27016@debbugs.gnu.org; Wed, 24 May 2017 00:52:39 -0400 Received: by mail-qt0-f225.google.com with SMTP id s58so21026025qtb.2 for <27016@debbugs.gnu.org>; Tue, 23 May 2017 21:52:38 -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=R9xuZzW1KlFCzX87x2j01rgT4h2lDBzLrsymXgfgCqo=; b=X7YnHujMz3LuD1LnGL7ZOYkRkWrUiEI3azk7LQtZXPeeln1SGtt7XTbiN7BCUyIkxF AvMeWs/uiECOleAE9acypWXMOfJDydfUJoawo66s4o0ZG2Fw/Hrs81oiWpHqxHe+3rm1 ZrxXizD448EWEQAVxKv3YPpLfyx0aEbfbeA4s= 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=R9xuZzW1KlFCzX87x2j01rgT4h2lDBzLrsymXgfgCqo=; b=db8HebNo+35iT9WRDJyATkPyHFSYQIAIwFb0BrNEjGAfqB2nP/foVcwC5UThumu3DN 00SXvkbxXrAJeus1OwTKe7YHvKhi0Ogt7r0RdtmxCkolDhe8+WamG7QIx2Ux1eXvZ+Ht 6VxG/MkWaHKrvaNPDpSQU9gFf9v9NjB6ljlVPk6FZpHVk5K/kaHoYp0EoYjYGqxup7CJ HdSVfB3x9RHC1IfpH2MUjz/yLxiTLEf0I4w7G8gzgbK6n/aFR9IzdDC2yvlUm0b3qOkg 0jvxP6WkKyBVHLmQgkhndo2natFg2iNEQMUb6mSAVPuK4iRp/CVHFm+Fiv9YmSl549aD WO3Q== X-Gm-Message-State: AODbwcANYSK9dZrMQezaq1jwNr8yEKE22Kq1DPwuXPJhjrtrxCz2sVHl TDjvElr9cLXWKouvRe0PNnm2OwG0IeYdSBjvTiBt X-Received: by 10.36.118.12 with SMTP id z12mr6827162itb.47.1495601552773; Tue, 23 May 2017 21:52:32 -0700 (PDT) Received: from mail.perimeterinstitute.ca ([38.104.158.162]) by smtp-relay.gmail.com with ESMTP id u4sm1096730ita.0.2017.05.23.21.52.32; Tue, 23 May 2017 21:52:32 -0700 (PDT) X-Relaying-Domain: perimeterinstitute.ca Received: from mars.pi.local (mars.pi.local [10.10.7.6]) by mail.perimeterinstitute.ca (Postfix) with ESMTPS id C0F9CC0075; Wed, 24 May 2017 01:01:43 -0400 (EDT) Received: from rsorkin by mars.pi.local with local (Exim 4.69) (envelope-from ) id 1dDOHi-0000sh-3R; Wed, 24 May 2017 00:52:34 -0400 From: Rafael D Sorkin To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' X-Mailer: MH-E 8.2; nmh 1.2; GNU Emacs 23.1.1 In-reply-to: your message of Mon, 22 May 2017 19:15:57 -0400 Message-Id: Date: Wed, 24 May 2017 00:52:34 -0400 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Rafael D Sorkin Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) > `defun' takes effect at runtime (or rather it expands to > `defalias' which operates at runtime), whereas `defsetf' has > to affect subsequent compilation, so waiting until runtime to > decide whether the condition is true could not really work. Well the way I was using it, everything used to work fine. I found the bug when it stopped working and I was unable to figure out why. I had a defsetf inside a conditional in a file that was to be loaded and/or compiled and then loaded. (Compilation isn't really the issue.) Before loading that file I set a "switch" which the conditional referred to. That way a defsetf done before loading the file could be either overridden or not, as desired. I found the ability to control the defsetf this way to be useful. However, as I wrote before, I only used this device a few times, not so many that I couldn't adapt to losing it. ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- Rafael Sorkin Perimeter Institute for Theoretical Physics 31 Caroline Street North Waterloo, ON N2L 2Y5 Canada ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- From debbugs-submit-bounces@debbugs.gnu.org Wed May 24 18:52:02 2017 Received: (at 27016) by debbugs.gnu.org; 24 May 2017 22:52:02 +0000 Received: from localhost ([127.0.0.1]:36704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDf8L-0002Es-Tk for submit@debbugs.gnu.org; Wed, 24 May 2017 18:52:02 -0400 Received: from mout.web.de ([212.227.15.14]:58447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDf8K-0002EX-G5 for 27016@debbugs.gnu.org; Wed, 24 May 2017 18:52:01 -0400 Received: from drachen.dragon ([94.216.140.150]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Ly7vR-1dzUNT4BC1-015dyc; Thu, 25 May 2017 00:51:39 +0200 From: Michael Heerdegen To: Rafael D Sorkin Subject: Re: bug#27016: possible bug in `defsetf' References: Date: Thu, 25 May 2017 00:51:37 +0200 Message-ID: <87r2zdc1hi.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:fiJzGlzDODcEDabu2/G5MUsGmu4KKRfvUl1WF5em9uLqFLKrsXI IIX0QhOAhfTp2+4FSsKHBWgMowhyii2Q++/J6/SakP1OwjTzneJfU/ofGvtBaD7Q8BB5RPR 0wx8hrRmL4+wZfnmpEMundfc5+jfYcJ6fb/dgb5cvykdbKsvC0huxAiKKabGaXYYXq9LTFe /wooP6mrVVTe07PzfroTA== X-UI-Out-Filterresults: notjunk:1;V01:K0:ENKeO4Ea6Ac=:GxYF+apWz0q67+K+dF0oAU jqsRD5srqEovXHYLd6tZHOIbV1CcQviHKph0z6CT6N+GTRf/LDvbuT66CZNNJME/rvXzbo54X JRLtMJWivoAE4v4D8sIgr5qVQ0LGluTuu/GPqNAjGgwXJ5QVoqVIm/ZTlSCbETYH4MwWNUFEF JI21QSAIE7vosYQ68mBtnhjZp5jX3daXo04kaVcMuBWfA8bLHbeGrOkT4ixig6l4ebqwIvGhw u26KzvF0xIEPmG94IRDVaCk/XdVNOtALWcd4E4vD1JvrAfSicTUb6lJHcXi4GaBXqsMiatc5E y/To+JYmZrhuE87Q0BcLb9aBrmcTmLD91F2RVmg2utG1k/gv55VxZgi25tvV06J709G1Zcq4m zq9s6GIaTSiEZRPLECAvtIk9baadMrZPFuE6bPjlzEZITy+7KtJdCSeYNYcJDJK7BCAeSuMMY WZ5F0byJO8RfbAi/j0+MTewRn66sehr1s1IjvMk97DY5wL5OLJQNtnCw9TZbmXn0/tAjb807B M2TPGwmLrFlasAntXhtbvUaCFca/UYgooyRxxuVdkmWLPSlMGWzJ/TfFC/yEGsw0MDVsboF8A MOFQ2XnpnlqK/oPTLekpw464ea6ifghXfOD3tDvFTV7uJYP96WZkHw5DCy8s0NLdGzIlIfsfU D88bc3dLKvaPnffrgnWW6yIeRu+1t+wcYZ7trxMW+DtfRiH9GXNBnrCbUp79co+k55bkMFNrg JjKQ2cYLUM8tfJpviFK6XAobXVc+1kQOZQoqoK70Jpa9bMKWRS/r10YIk5z/HUg8hqszaCU+o 6ZTuMLf X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, npostavs@users.sourceforge.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.5 (---) Rafael D Sorkin writes: > I had a defsetf inside a conditional in a file that was to be > loaded and/or compiled and then loaded. (Compilation isn't > really the issue.) Before loading that file I set a "switch" > which the conditional referred to. That way a defsetf done > before loading the file could be either overridden or not, as > desired. Can't you just `defsetf' unconditionally to a named function, and change that function's definition when appropriate (in a conditional)? Michael. From debbugs-submit-bounces@debbugs.gnu.org Wed May 24 21:49:27 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 01:49:27 +0000 Received: from localhost ([127.0.0.1]:36748 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDhu3-0006Br-ES for submit@debbugs.gnu.org; Wed, 24 May 2017 21:49:27 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:35351) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDhu0-0006BV-7X; Wed, 24 May 2017 21:49:24 -0400 Received: by mail-it0-f66.google.com with SMTP id 67so21534423itx.2; Wed, 24 May 2017 18:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=5Xz0avVWrs2iXXArUULDjf9tkcDnHscxu8jzqHOULTs=; b=i84bbl0XT/nEIQaJ/v/9cID4jvAAFXgPKhymojUG0eQdWqS8AFRGro1pxO1QHDuw5h IJgdHOV3/Vx54oMS7t0y4pSoMla1f1UBaR6oEIeuGHY4A5r7bspWvXzvac+pmLBRoblB bqC0Lq+ZmsExcA86KV3H3jzH5dJjlEU7aikSEwYrSLQbuM63H+QUQdvhGGPpmWnXsHsH zLdOSjbKXdkJmp+vMgqBLDHJ28FgXXTM7EVPwSiF5/gcTAkXXV+b+VqrOEb++/2BMOte KGtzaGYxF8t/2Gxo/SRo20LUwN0ZocC+Os1+izuvXC3vInIh7NmDAxCVInNBx4L9ag+W bTQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=5Xz0avVWrs2iXXArUULDjf9tkcDnHscxu8jzqHOULTs=; b=kkoqOpWUb3BDX3emRFXsR87FZWP3Yt1pxgEHboRLv3dC7MNyt53KaAc6hW+LtMSwFf Nz3K+jb0n4VcydWarsbN8gwQlxvXoTfrR+a91cOfD+QyssoGPqc/4MH4GmzHC36yiv4h TdqBURkp9fWB1xaECPwGMg7McnGcY20cpZinfF4/FZZTwJcEZUf04W+luHEqwQfYezWa lvbLVFWZ5dQ1wBxOKBswNH8qjBs+eZyQ7OiWlqLNx/xAhGOZQCUGykNHiuU0NAzXRve0 M9SkkxCgSmnLfmhQ8cKlFox5KeaUQU756lkQ7YS/XC1fZWO8HKAepK0qetBRG3A47bzR Y/gg== X-Gm-Message-State: AODbwcDRuuH41KWmmtdUiD/qWc61k6/A+5aHCLtQznhuIaEoPfOesmjx cyPcovsgZerGCvLE X-Received: by 10.36.173.70 with SMTP id a6mr11443866itj.110.1495676958427; Wed, 24 May 2017 18:49:18 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id l19sm2477176ioe.3.2017.05.24.18.49.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2017 18:49:17 -0700 (PDT) From: npostavs@users.sourceforge.net To: Michael Heerdegen Subject: Re: bug#27016: possible bug in `defsetf' References: <87r2zdc1hi.fsf@drachen> Date: Wed, 24 May 2017 21:50:55 -0400 In-Reply-To: <87r2zdc1hi.fsf@drachen> (Michael Heerdegen's message of "Thu, 25 May 2017 00:51:37 +0200") Message-ID: <87vaop66ww.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) tags 27016 wontfix close 27016 quit > Can't you just `defsetf' unconditionally to a named function, and change > that function's definition when appropriate (in a conditional)? Or just (eval-and-compile (unless t (defsetf foobar setcar))) Anyway, I don't see any likely solutions to make this work exactly as before, so I'm going to close this as wontfix, but feel free to continue discussing (and/or say that I'm wrong). From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 00:59:16 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 04:59:16 +0000 Received: from localhost ([127.0.0.1]:36827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDkrk-0003sH-1p for submit@debbugs.gnu.org; Thu, 25 May 2017 00:59:16 -0400 Received: from mail-oi0-f97.google.com ([209.85.218.97]:34965) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDkrh-0003ry-N9 for 27016@debbugs.gnu.org; Thu, 25 May 2017 00:59:14 -0400 Received: by mail-oi0-f97.google.com with SMTP id w10so22691290oif.2 for <27016@debbugs.gnu.org>; Wed, 24 May 2017 21:59: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=qWaFB2NR8lvhGnZsPLaxC8+uy3zhFNs4qMX487S+9Nw=; b=E4OTwKFPcGo1LPq72QGPdm6rMKqIbKFfSjbLxVJpEP7GR2e3mO39JrZWLur4fAJisD INFEt0kJCJTLC8vB8Z0sZYY35evvEvHH0jvU/vxpCE67wc2j6B05fJwWsGwlifOg51Ji D6vCEbdSqbiTSzOjKfyxPhg2Vpg4eMe6x13hM= 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=qWaFB2NR8lvhGnZsPLaxC8+uy3zhFNs4qMX487S+9Nw=; b=hCjUOirmx2U148If4Itu+HT94c/69hrlShuQ9FHYagMqrja1K5wrZqly7jucN8Rboh qnV38fP6XWQVsMyb+gRTqqfUArBlxw2LV6aYCCqocCva6BvAMd2jjbTZ6JxbmjdHy/ih 42wi1NIGD0rbTZ+zb/+XZ2pQewGiyR2xI/1KBbhiBZkGPQ5T/Ea9jBR+OzDkCupim/7T qPf+HXTjfAeuI+vv+RCg01W0id8jsx3+dxL6ryo5FTEcoo1jj3VZSqfHkMA7JvgRCFuK bMeuuZrDHaCyZL+Vvgdq7kByleuP9O+jz7aCjw5neSfhHF62xDpO+zlhGXsp2w+1FGRW mpvw== X-Gm-Message-State: AODbwcC8XxfP+jmxRfJ19OkGPkaJ4u3B6GoJGnD+kWHKMqQdXOJ78wGg Kwfd3XLaqnQHomfcAlulQMEAEp+mtDbyV4ifo1fY X-Received: by 10.55.97.76 with SMTP id v73mr34989129qkb.241.1495688347015; Wed, 24 May 2017 21:59:07 -0700 (PDT) Received: from mail.perimeterinstitute.ca ([38.104.158.162]) by smtp-relay.gmail.com with ESMTP id 6sm969515qkx.2.2017.05.24.21.59.06; Wed, 24 May 2017 21:59:07 -0700 (PDT) X-Relaying-Domain: perimeterinstitute.ca Received: from mars.pi.local (mars.pi.local [10.10.7.6]) by mail.perimeterinstitute.ca (Postfix) with ESMTPS id 1D606C007B; Thu, 25 May 2017 01:08:23 -0400 (EDT) Received: from rsorkin by mars.pi.local with local (Exim 4.69) (envelope-from ) id 1dDkrc-00078r-Cp; Thu, 25 May 2017 00:59:08 -0400 From: Rafael D Sorkin To: Michael Heerdegen Subject: Re: bug#27016: possible bug in `defsetf' X-Mailer: MH-E 8.2; nmh 1.2; GNU Emacs 23.1.1 In-reply-to: your message of Thu, 25 May 2017 00:51:37 +0200 Message-Id: Date: Thu, 25 May 2017 00:59:08 -0400 X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin , npostavs@users.sourceforge.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Rafael D Sorkin Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) > > I had a defsetf inside a conditional in a file that was to be > > loaded and/or compiled and then loaded. (Compilation isn't > > really the issue.) Before loading that file I set a "switch" > > which the conditional referred to. That way a defsetf done > > before loading the file could be either overridden or not, as > > desired. > > Can't you just `defsetf' unconditionally to a named function, > and change that function's definition when appropriate (in a > conditional)? > > > Michael. Thanks for the suggestion, Michael. I think it would work, but the function I'm aliasing to is `symbol-value', and I would feel slightly uncomfortable to insert an intermediate function which would have to either call `symbol-value' or be redefined to be it. Fortunately, I hadn't used defsetf inside a conditional more than a couple of times, and for those it was easy to devise adequate workarounds (once I understood what the problem was). For the future, I have resolved to use `defsetf' only at top level. - Rafael ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- Rafael Sorkin Perimeter Institute for Theoretical Physics 31 Caroline Street North Waterloo, ON N2L 2Y5 Canada ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 01:01:09 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 05:01:09 +0000 Received: from localhost ([127.0.0.1]:36831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDktZ-0003wR-Dy for submit@debbugs.gnu.org; Thu, 25 May 2017 01:01:09 -0400 Received: from mail-oi0-f100.google.com ([209.85.218.100]:36856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDktX-0003wE-SQ for 27016@debbugs.gnu.org; Thu, 25 May 2017 01:01:08 -0400 Received: by mail-oi0-f100.google.com with SMTP id w138so22690046oiw.3 for <27016@debbugs.gnu.org>; Wed, 24 May 2017 22:01:07 -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=vNUPKSQucU/aWOXSntRPInMR06dN2zyu3sBFDK+AW9c=; b=CWnFZOso+6JVK3zbeP6wnVmc/kBSKqcQKU2fwvojZSq4Z1ywaAn4vKcXerYZxpefsQ veN/RDSijQbg0yG433paTdqsT/sZKLo1rPlWU84QZwAMf5H9XnQdaC8r3zTorb38ctxG s933Lnz/3LRCvFv1fDuhc8ByTSg3P+nlcq+vg= 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=vNUPKSQucU/aWOXSntRPInMR06dN2zyu3sBFDK+AW9c=; b=GC8BMnVa/amiIW5ZHEHi4OYOLrVfLksgQE/1uiugS2lux2Df9GN++pnqvTOv+gP24F kwbmnzlz/DPqJhvcZc3wcAxIQdRX2ABU5cCp1nd4WqOUHW0uQFLN4Q3cZFLCZ2fcT7h+ wcIbNoPdNe+A4YrmL19Z23oJKaGJ7PzS8C/ISUb1xydm4VtJFapyp1nFYWbaO4Irbsuy iwkVb2PCn0Gy//5xBT2QUhQ/9gTQXm/afrdhZZm73l+ySUmDl3hyjskDJaPTca2tAgyB BqbdrkRAlPG7vN1NY2AtVFIreKcFmBHFjqU3742aEmwXLw8DwNzNOiCozVpM1cQJjZEN obQw== X-Gm-Message-State: AODbwcCFQm7dORlbSU0AzvOLBeEJVPke0GuOJ++mbop+MU4GOimMAIoC RroEFwMUgHnMGR+yIoTJAqP0Ie5y6w5Bv77KFChw X-Received: by 10.200.39.171 with SMTP id w40mr29740706qtw.87.1495688462384; Wed, 24 May 2017 22:01:02 -0700 (PDT) Received: from mail.perimeterinstitute.ca ([38.104.158.162]) by smtp-relay.gmail.com with ESMTP id a15sm914795qkj.5.2017.05.24.22.01.02; Wed, 24 May 2017 22:01:02 -0700 (PDT) X-Relaying-Domain: perimeterinstitute.ca Received: from mars.pi.local (mars.pi.local [10.10.7.6]) by mail.perimeterinstitute.ca (Postfix) with ESMTPS id A7AA2C007B; Thu, 25 May 2017 01:10:18 -0400 (EDT) Received: from rsorkin by mars.pi.local with local (Exim 4.69) (envelope-from ) id 1dDktU-0007AL-2h; Thu, 25 May 2017 01:01:04 -0400 From: Rafael D Sorkin To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' X-Mailer: MH-E 8.2; nmh 1.2; GNU Emacs 23.1.1 In-reply-to: your message of Wed, 24 May 2017 21:50:55 -0400 Message-Id: Date: Thu, 25 May 2017 01:01:04 -0400 X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Rafael D Sorkin Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) > tags 27016 wontfix > close 27016 > quit > > > Can't you just `defsetf' unconditionally to a named > > function, and change that function's definition when > > appropriate (in a conditional)? > > Or just > > (eval-and-compile > (unless t > (defsetf foobar setcar))) > > Anyway, I don't see any likely solutions to make this work > exactly as before, so I'm going to close this as wontfix, but > feel free to continue discussing (and/or say that I'm wrong). One problem is that, as far as I know, common lisp doesn't have `eval-and-compile', and my code is meant to work with both elisp and common lisp. In any case, as I wrote to Michael, I plan now to use defsetf only at top level. So thanks for the suggestion, and do feel free to keep this bug closed as "wontfix". - Rafael ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- Rafael Sorkin Perimeter Institute for Theoretical Physics 31 Caroline Street North Waterloo, ON N2L 2Y5 Canada ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 06:37:25 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 10:37:25 +0000 Received: from localhost ([127.0.0.1]:36960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDq8z-00054o-7R for submit@debbugs.gnu.org; Thu, 25 May 2017 06:37:25 -0400 Received: from mail-it0-f46.google.com ([209.85.214.46]:36703) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDq8x-00054V-87 for 27016@debbugs.gnu.org; Thu, 25 May 2017 06:37:23 -0400 Received: by mail-it0-f46.google.com with SMTP id o5so54051670ith.1 for <27016@debbugs.gnu.org>; Thu, 25 May 2017 03:37:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=u0urPGd269kuIDyZAn4aMVtUMi1fzIpKQGzJRu1jb0k=; b=IhzUFeqR/FiC8imVcB8Fq0jpAGJshlv1ZrDQmmDyEDs5xFJhtHxLjUSqGyz6q72PrY MW5/qEx9R4Gtp8Mu1rBL63L/AqJDG2Lqom0Bo+6l1Qky09vB+FiydRLF053uPvC5r1B8 pS99Edz5LZAHDDdHoUSUp9NouF/4z4OiurEaMnnupKD+tgjNiULPdFuhOkvKRNIa1QvE QP/3JPsm541rpmDQ7C2TG3BUFs79hqyJ8wxcXhjWEZFOqQi5wI5CivrVIHVcuMteZzI/ hUSZalt+Nc/wpj7QVqKTwPMBMJIKXuxgUoqFl7jY7gZSGeF1eUikqSJMmK2vqWOl+KPC VZMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=u0urPGd269kuIDyZAn4aMVtUMi1fzIpKQGzJRu1jb0k=; b=ZI5DvAFATuAbFGi5+une310yQIyPF995IBYMazRa9IvUCEUbJdV4CkUfEz25ryFVl1 XXJneh6CTvHQYOdeCPkc6OseeNcV+CSk7r3T7nItqtaC0FHYpX7p59Xm7YWqFclvJmB8 p4G4o56jsYWfPOb1Pfu+MjPBrAKtLkUmDPXTNvWMJisDx+4K6ddO+Uj9/P0X1PGghps7 sGN9l7Kcw0UPbf+OkT81d/dzNqZife2xCEBsd5V8Cqs9mmKrEsce1kJIog7yisUaOlC5 op8GrWrxYRcBFSRKwWq77PeysXRwKhj1QUJTUeaAQh03WDhJ+DOsjOwJVJX7ndlpX4hL FnRA== X-Gm-Message-State: AODbwcByjW4a6Kk7vbaLY2BPevj8GjjT8jr3lb4vWMYrkSktsRLoj5Ca iZHyudQIrHYaHg== X-Received: by 10.36.246.136 with SMTP id u130mr12484613ith.54.1495708637630; Thu, 25 May 2017 03:37:17 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id s89sm2820053ioe.57.2017.05.25.03.37.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 May 2017 03:37:16 -0700 (PDT) From: npostavs@users.sourceforge.net To: Rafael D Sorkin Subject: Re: bug#27016: possible bug in `defsetf' References: Date: Thu, 25 May 2017 06:38:54 -0400 In-Reply-To: (Rafael D. Sorkin's message of "Thu, 25 May 2017 01:01:04 -0400") Message-ID: <87poex5igx.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Rafael D Sorkin writes: > > (eval-and-compile > > (unless t > > (defsetf foobar setcar))) > > > One problem is that, as far as I know, common lisp doesn't have > `eval-and-compile', and my code is meant to work with both elisp > and common lisp. Oh, I think `eval-when' should be equivalent: (eval-when (compile load eval) (unless t (defsetf foobar setcar))) From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 16:27:06 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 20:27:06 +0000 Received: from localhost ([127.0.0.1]:38175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDzLe-0002tl-DG for submit@debbugs.gnu.org; Thu, 25 May 2017 16:27:06 -0400 Received: from mout.web.de ([212.227.17.11]:51943) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDzLc-0002tE-6C for 27016@debbugs.gnu.org; Thu, 25 May 2017 16:27:04 -0400 Received: from drachen.dragon ([94.216.140.150]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MWSBi-1dSqPj23hK-00XbSG; Thu, 25 May 2017 22:26:41 +0200 From: Michael Heerdegen To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' References: <87poex5igx.fsf@users.sourceforge.net> Date: Thu, 25 May 2017 22:26:40 +0200 In-Reply-To: <87poex5igx.fsf@users.sourceforge.net> (npostavs's message of "Thu, 25 May 2017 06:38:54 -0400") Message-ID: <87vaood6nz.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:9OD59oTXn0fImO/UuzcT7qtqRS+YJa4vAwrj5Z2biC/sg+4FcYh XpM7l3Tg/+rtvQR1h9cxqcBCQvMNjtmljPMzVzoKsUbSy4nDextzO09Mczv+hXiuPjqirNH jXEI2bPLCgi6HJBL86lLMOQidwrkHHwIaKciPx5nB2L8NCeayoyXMrWXdRD6Fz6vBc41js1 vFSCmqI7affmNHp33+f5g== X-UI-Out-Filterresults: notjunk:1;V01:K0:zhDyKpKKEG0=:A7nDKfYPutWNmFwevMCtLf whBnCZzUZ+iLtYhrgx1oatYXlCZwiZG4eVuOFRiA9pDjdvQ4HqCLU7ASLoup7yws2EQDYmAkT iJR8P5Tear8pMYD3uaMZw/+JmHEa/Yx44T/wk8KmuLKdWBfh9zDEVWg0K9s81Kue1Gv0b46WL XZJZeNL1c65628x/Lf7zKmmDNZ5RjOELh6YBIjl8Yz+4fwBxZvOIr1laPFe0IQoLkDFZ2I9kZ eCGhMw6Au/KNPxH236qxo5lRttAZnEUXgcUsuHqUD/G26/+VE6NZrVG+JUcPHuNHvMvnU6jIS L+RtyVQpBygSoJeVQICIRZQsPTAl2hkXOqm7Lpfbwjd6pDjxX2GtrC9LD8kyuceWpGmKJRC1s pUqBgdonELihFq69kLmliGDQWw6TbU0XNx/FhQIu6hon0uacwmbk8/26YNV+v94K3EyZCs6KC +n5Lv9xLw8FQz4n5fQDEq1JptbEx+SibyfYs70YZNJvPwUrODZx2cbfUHwu2Cc/n5J//B8XNJ aQVt4Z2XWmMLyJqEfLTLJDXitfbBRHWMstSXG3wwQT6RMLXQ6/McXXD9yEEexm5VpLpLUqCep rLoIPIpP/nV3TPmJjubfUbo3b4GW982RPTxn+kN5St4FQnIg64DTCzRStL3hAH+pQzRHYzrSV 4l1SlWirpNFNrZiW40TC/KYtBIliL9wcx6Oga3OTpEaCKS3n0RsCwPFm5yEATYNC0ItTDeikx itpsHJYReDzOrEG2VEjHZtoZPDcrqqWNykyBErv3sdagrm1xRREqZsm2kziKuQhfoNHmqek4C SehiuZH X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) npostavs@users.sourceforge.net writes: > Oh, I think `eval-when' should be equivalent: > > (eval-when (compile load eval) > (unless t > (defsetf foobar setcar))) FWIW, I don't understand. Doesn't that just expand to the same code as before when evaluated? That code is just evaluated under even more circumstances. I would rather try something like #+begin_src emacs-lisp (unless t (eval '(progn (defalias 'foobar 'cons) (defsetf foobar setcar)))) #+end_src to avoid the eager macro expansion unless the code is actually run. Michael. From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 16:42:57 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 20:42:57 +0000 Received: from localhost ([127.0.0.1]:38195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDzaz-0003Gv-Lc for submit@debbugs.gnu.org; Thu, 25 May 2017 16:42:57 -0400 Received: from mail-oi0-f48.google.com ([209.85.218.48]:33325) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDzay-0003Gj-BT for 27016@debbugs.gnu.org; Thu, 25 May 2017 16:42:56 -0400 Received: by mail-oi0-f48.google.com with SMTP id w10so295547945oif.0 for <27016@debbugs.gnu.org>; Thu, 25 May 2017 13:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=jTlwalVLVculQ3U8ILsk4fwMBgXHNViM8AZ5FijFmX8=; b=PxwSKDi7WuRHoQyZmK+1fcyf9D1VHMAr8RNBr4DOpDgxhcxK4Gvan9ofOdw0/j2A9G uqZ4SbbZqBk17oTmc1RePPDhoc+XmsJgPCJNECS7xPw5nWILsI34VLV7ajix77viRT6e 3kypADUkaeY0NraCgkfJPoyBFi8KGtY0t9jUo2lnQoiba+QRtGvw9Noe/iRKPgn1mM8k tk1TfuXtsNgFnqsUkUmajMXYhdnA0FgzZYnD2ZYGbFAHdIxtO0/UAhOSM6w4Bkk17nxH QqOIkruZRZdb/E6wnniYUx672eCCorm/pX9QdIAjL1Esz6rMTAXj+66Op9kKGMjr0JZf C/wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=jTlwalVLVculQ3U8ILsk4fwMBgXHNViM8AZ5FijFmX8=; b=q8BT6SnBCUM6YJKIREWsyYrXDeBM70D7p0IrvjQ9rwABUvqG+DwJYw1JQhrySv8BPE MfseWWOlX4VAMwSdf4vwd6qE/8Bh/O137G5hCPIvhrxweBenNMqPqB3KFTaVCCN0jjxt SM/62Jy2azMBcKlXIOuqYk5U35Bgzr4zv3fY1tLsFEBpDXwU7gIv29oYdz95UytNYOBV Q3TrxY4wrw2PfJpdw9RtQBK07st7CCfd5utNa/DPdsTbuHFMZqinvTVIMF7bS2GVUurc ZXqrOrPMGjvc8laJ1bYXeKsPzlP3HLgaUhYw3VaQ/K7OK0fUcOgE5F3SMr7lCGKfQ7EK kxzw== X-Gm-Message-State: AODbwcBDzrC0SYz255kNw0i0FhKPG7x70ucYHEVle7rmdsOwGmi/LYyL KNRwz3gSFuEezM6B/frpSBcHdCSEIA== X-Received: by 10.202.240.130 with SMTP id o124mr7692923oih.110.1495744970549; Thu, 25 May 2017 13:42:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.139.83 with HTTP; Thu, 25 May 2017 13:42:50 -0700 (PDT) In-Reply-To: <87vaood6nz.fsf@drachen> References: <87poex5igx.fsf@users.sourceforge.net> <87vaood6nz.fsf@drachen> From: Noam Postavsky Date: Thu, 25 May 2017 16:42:50 -0400 X-Google-Sender-Auth: SRWw5C33uirTHmZdWdGgitwwGRE Message-ID: Subject: Re: bug#27016: possible bug in `defsetf' To: Michael Heerdegen Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) On Thu, May 25, 2017 at 4:26 PM, Michael Heerdegen wrote: > npostavs@users.sourceforge.net writes: > >> Oh, I think `eval-when' should be equivalent: >> >> (eval-when (compile load eval) >> (unless t >> (defsetf foobar setcar))) > > FWIW, I don't understand. Doesn't that just expand to the same code as > before when evaluated? That code is just evaluated under even more > circumstances. Hmm, I thought it would cause the 'unless t' to happen in the macroexpansion phase as well, but I was wrong. Apparently 'eval-when' doesn't have this effect, only eval-when-compile or eval-and-compile will do the trick. From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 17:31:40 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 21:31:40 +0000 Received: from localhost ([127.0.0.1]:38258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE0M7-0004RK-91 for submit@debbugs.gnu.org; Thu, 25 May 2017 17:31:40 -0400 Received: from mout.web.de ([212.227.15.4]:57778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE0M5-0004R7-Bd for 27016@debbugs.gnu.org; Thu, 25 May 2017 17:31:37 -0400 Received: from drachen.dragon ([94.216.140.150]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LoLKj-1dtflS3ZwP-00gEKP; Thu, 25 May 2017 23:31:15 +0200 From: Michael Heerdegen To: Noam Postavsky Subject: Re: bug#27016: possible bug in `defsetf' References: <87poex5igx.fsf@users.sourceforge.net> <87vaood6nz.fsf@drachen> Date: Thu, 25 May 2017 23:31:13 +0200 In-Reply-To: (Noam Postavsky's message of "Thu, 25 May 2017 16:42:50 -0400") Message-ID: <87o9ugd3oe.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:XhUcM1oMzbu9/gFxkSzFhzWJ96jPwx+aaGKPQ5uOF8XUj+0Qrd+ eWTjUFtww9vg+crt4eGkHCx3aaACC1vlJBqA+aIY/UHB8wmKJWo2pFtpXGRWDckrG/FXdMs ugkFVE6/y/sEb4S5jtmASwykyOma32cHnPYgse3lwmjo0bz/8QTfp3y0O0k+FUYXfLnT2EC TCUYQI3iClIj/BUFEMVvA== X-UI-Out-Filterresults: notjunk:1;V01:K0:zGD2LWzgvfk=:Qwi968EOXbV3eCAiW/ZbVE 514rQL4vphwGYxvzCwYa/giOeACZ4XgGWujxlxYZIbRPDc1oUbPLiTTEnNvjCPReS/FsWU2dc 73+uvjdq3YLocgeqBkGaIHOEU+/ar7wBMvW9plN5y3LuxW2mSjh1xwOVtRYTEHbFRdTzp7fV4 SllBJZpg+al15/t9SzOLXnmqFqXVVkkG8ds4EFjGd70zGGe8Ob90gAs2SSUndOxOiylGxp/zN 96m/amTpe7BPymESWjBkBaNuIJuSblDfFiVaQiVLRntB4+jYqGJHKx9nqfTNY5FCtsjd/FWTh WAF/GZt7FwaFLpuiY0hNBEtH15+HCt9BJsCYtc71pgDbj/4u7wWvdERVEpIr8tmD4CZNM83Se mEM0qgIMNMVAlkOmB33yLfUL4BkEcHUuxyM8meUIlh2XGX+Pm3kB0GMpA+bjBiyrd/gFKiebi eAYRHQ6LLNAw4UZZMUasS5tletBfZd90ESOvDeu8cmNcOFKzWMDKIGDrdeAmuHPQAbMI595EA VTZPXwQvJ2tE2tpeM3BMAb7+0QhLc4q165EgWmNkuwzn4oUutQIgzUF/fCzuxjEz5DkuzHzV2 AJSXyzUAKuiZEAWHYThapJ3xGqHx2mJS5VWKi2f3JqRdsS4P/OvVs64EZf3966FFrEL5JRhq3 g0yn1VtbzEjwQyMiwOyeWSIQqALLHZsk5fOfEkyd7Jz6TrZuqmafC1QY9bmX+tyWQx1BTnRF7 +98BNUMZbHkkLugPDETDdF/ngMBe2ChV2SnosA8YPxBnQJpZt/Xkd5SPdcm8frtcVZ0UuLfJW hM2va4Z X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Noam Postavsky writes: > Hmm, I thought it would cause the 'unless t' to happen in the > macroexpansion phase as well, but I was wrong. Apparently 'eval-when' > doesn't have this effect, only eval-when-compile or eval-and-compile > will do the trick. That also doesn't work. Apart from the fact that you would have the `defsetf' executed at compile time as side effect, #+begin_src emacs-lisp (macroexpand '(defsetf foo bar)) ==> '(lambda (do &rest args) (gv--defsetter 'foo (lambda (val &rest args) `(,'bar ,@args ,val)) do args)) #+end_src (i.e. a constant!). When you compile a file with this content: #+begin_src emacs-lisp (eval-and-compile (unless nil (defsetf foo bar))) #+end_src you get an empty .elc. Isn't that strange? Michael. From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 19:01:42 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 23:01:42 +0000 Received: from localhost ([127.0.0.1]:38339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE1lF-0006XX-Vp for submit@debbugs.gnu.org; Thu, 25 May 2017 19:01:42 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:36566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE1lE-0006XF-Hb for 27016@debbugs.gnu.org; Thu, 25 May 2017 19:01:41 -0400 Received: by mail-io0-f172.google.com with SMTP id o12so318034iod.3 for <27016@debbugs.gnu.org>; Thu, 25 May 2017 16:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=I6ASGHS6949qHf955xFCdeEUUd/5XjN5aK3TW/FQX2I=; b=OQ3ir32wUwpaYaII6DDrj2FN5CadYYdb0I8vKWo3qv0UGskUxdxbt/25+7rU46cwqX 4P6vRqF8XwhWrseM2G6AW7h9ER4ODobx5inoEZWLH3GiukhAOgq+UFKuV93p7OdXz9Bi zrtmSE5wgkUBr7UN0b4e9oWNX1pMibng8s4EECOOvANuR7EEbahQW/rEsLuMAO5WNtqX JJR2KXUhgFHKHAEryIXzRnnyvfW0828ihfHY782XCAOdQo2vCm4rxcVdOJjdb0vOvloe 7FNp2vj5JIGtn/yOfAkx4c031aZQOXKeJ+TcvVTYbpNABs1sNAv3xvt6aQFKpabfC+pJ G9Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=I6ASGHS6949qHf955xFCdeEUUd/5XjN5aK3TW/FQX2I=; b=JgX+Oi4rmNTerjvB2nZnqydcTN5ABkuWuaGIMxm7sLi7vABey2xd7MZ9yCMj1d9WO+ jdokO6mWmpKlrl7v0vAREoZkjWTDcbSorRSHEeZiBFhv1lR1O/4pZSEEb3JBxCDxYLML kWaDCEKHgNveKXAG5sVKk+8tFM7xYEPrTxm2EmYrRQqs+y0xapjItB8anabPCKCdMve6 MryY8yVMijix5y02JktGkrtocFWLy7/uPlyVmyLuP0HbHMBj+Pwu3sLkh90Cdqo4B4NJ 6aexrZB43QgT5Csd390+5y+LTqS2BpbvYBOwcX2nlhgNIskQ95Nr16WQx6x0LypMAjSZ yoew== X-Gm-Message-State: AODbwcCkxTxQrZ8O6nA58RSnIQPRECw9wBXjqqK+8k/5XNeAGArv914m MfxQs41vcyr5RA== X-Received: by 10.107.185.10 with SMTP id j10mr45412250iof.3.1495753294708; Thu, 25 May 2017 16:01:34 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id c1sm4334itd.15.2017.05.25.16.01.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 May 2017 16:01:34 -0700 (PDT) From: npostavs@users.sourceforge.net To: Michael Heerdegen Subject: Re: bug#27016: possible bug in `defsetf' References: <87poex5igx.fsf@users.sourceforge.net> <87vaood6nz.fsf@drachen> <87o9ugd3oe.fsf@drachen> Date: Thu, 25 May 2017 19:03:11 -0400 In-Reply-To: <87o9ugd3oe.fsf@drachen> (Michael Heerdegen's message of "Thu, 25 May 2017 23:31:13 +0200") Message-ID: <87mva05ykw.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Michael Heerdegen writes: > Noam Postavsky writes: > >> Hmm, I thought it would cause the 'unless t' to happen in the >> macroexpansion phase as well, but I was wrong. Apparently 'eval-when' >> doesn't have this effect, only eval-when-compile or eval-and-compile >> will do the trick. > > That also doesn't work. Oh, hmm, I only checked by evaluating, I didn't actually try compiling to a separate file. > #+begin_src emacs-lisp > (macroexpand '(defsetf foo bar)) > ==> > '(lambda > (do &rest args) > (gv--defsetter 'foo > (lambda > (val &rest args) > `(,'bar ,@args ,val)) > do args)) > #+end_src I don't understand where that quote comes from. I guess I don't really understand what's going on here as well as I thought. > When you compile a file with this content: > > #+begin_src emacs-lisp > (eval-and-compile > (unless nil > (defsetf foo bar))) > #+end_src > > you get an empty .elc. > > Isn't that strange? Yeah, even stranger... From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 19:40:52 2017 Received: (at 27016) by debbugs.gnu.org; 25 May 2017 23:40:53 +0000 Received: from localhost ([127.0.0.1]:38361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE2N9-0007PP-Nj for submit@debbugs.gnu.org; Thu, 25 May 2017 19:40:52 -0400 Received: from mout.web.de ([212.227.17.12]:50326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE2N7-0007PB-P4 for 27016@debbugs.gnu.org; Thu, 25 May 2017 19:40:50 -0400 Received: from drachen.dragon ([94.216.140.150]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MbyIM-1dTv3V1ihq-00JLMO; Fri, 26 May 2017 01:40:19 +0200 From: Michael Heerdegen To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' References: <87poex5igx.fsf@users.sourceforge.net> <87vaood6nz.fsf@drachen> <87o9ugd3oe.fsf@drachen> <87mva05ykw.fsf@users.sourceforge.net> Date: Fri, 26 May 2017 01:40:16 +0200 In-Reply-To: <87mva05ykw.fsf@users.sourceforge.net> (npostavs's message of "Thu, 25 May 2017 19:03:11 -0400") Message-ID: <87d1awmrof.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:2BZPfkDVP1HIPSXNVMvbkEFVEtC2Th0sS5jOgqxCWcu4c1frAQt GYKzAYGO26r/DhDTo93yiF0Z33ZnEdwmCjnrkPpG8hGUBRiwIFpYs7xoE3n/TUXMuGAmuvW D91nnVo2Y0RgsUu56YCyD87is/VuqOrCtrlDCoSPvZlAjpk7/R6t+LjC4dFw7j7CLioeaqU jdHN3R7CaqOIMJ4bX2FWA== X-UI-Out-Filterresults: notjunk:1;V01:K0:6i7t91+O9x4=:OqkTU0lBINMr2zLOAmz6ao PlyQ7QjjSq0EsI451uuc5FFq/MSy2u8g+bE9q2r1y5rjtRIuvpc77mVMm5MDw73LaxTI82pKB GIoMLMk5GpP4Rr6ACNnZd3Eml1pbCmZnr3ayZjAslVErJKV9NLYaUY4Bfx0M0gsUudkKkqEAb Jqx4T8u+curWCDilyig1wJx6KSMF58NUlNhfDXm+Dca8igVDr6G3ZtdCZvRl3LtThT0vRgJjr 8+aP29Y4ioYDS//06MpvPBWq46jTJt28wiQPH+130yng2SuqFxWg3Qy+2YFaXxa/XK6kwxzy8 on/QOirbjdmhg7OQu48d8HbWriN9RoYMveIAQLw9lEMfQC9H9yk8xUb+2ju64NgFfXw/h0PeV cmfcukJmomjabZhigVW+1UnIAQuixIOnqHmQ4t0U/4sZ7nBOYAsm38GMndgnKRhGVPQI6tcmK E11i8zkimCskUQwGixt9kPdMoMcsJs0AtHsDmTRa7Moey7PCWn82PtW/3CU/FLt4SJ+hrmvsl YhZI/W8mKT/Nlz0zJ75FiC0EqvJfnpE7dAx5H6seDGxCfz+qaBhx103mtXaFiulVW/4uMokhi 2FkYss29eeZj/P0fJSt2OlfhQ/ypOTdKB/hzCDoAdZ/7OAlEe/9ulfHsyUGgJZKX2os+sMlOF deWinUeX7Qz/+ZqjJys1IEQZ6Gtc9dxglFHXOEeKNe5I1ffdkjkfOFm/HXDF52AriMSjMh+Zg FgC4mHLmY3kZHco34iVwygCwkKHFQYynj8S1GFG9/yTOUOS60RHUYf0gQ0lrZydXNjiI1Um2s W945BhK X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hello, I wonder now if the definition of `eval-and-compile' as defmacro is correct. Maybe Stefan can help (I CC'd him), he may also want to look at the rest of the report... npostavs@users.sourceforge.net writes: > > #+begin_src emacs-lisp > > (macroexpand '(defsetf foo bar)) > > ==> > > '(lambda > > (do &rest args) > > (gv--defsetter 'foo > > (lambda > > (val &rest args) > > `(,'bar ,@args ,val)) > > do args)) > > #+end_src > > I don't understand where that quote comes from. The `defsetf' expands to an `eval-and-compile'. The `eval-and-compile' expands to a quoted constant, see its definition (as defmacro). > > When you compile a file with this content: > > > > #+begin_src emacs-lisp > > (eval-and-compile > > (unless nil > > (defsetf foo bar))) > > #+end_src > > > > you get an empty .elc. > > > > Isn't that strange? > > Yeah, even stranger... AFAIU, when compiled, `eval-and-compile' macroexpands its body (see the defconst of `byte-compile-initial-macro-environment'). So what is compiled is essentially #+begin_src emacs-lisp (if nil nil '(closure (t) (do &rest args) (gv--defsetter 'foo (lambda (val &rest args) `(,'bar ,@args ,val)) do args))) #+end_src and that's just discarded. Michael. From debbugs-submit-bounces@debbugs.gnu.org Thu May 25 23:50:59 2017 Received: (at 27016) by debbugs.gnu.org; 26 May 2017 03:50:59 +0000 Received: from localhost ([127.0.0.1]:38425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE6HD-0005Ia-Dk for submit@debbugs.gnu.org; Thu, 25 May 2017 23:50:59 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:58004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE6HA-0005IM-PO for 27016@debbugs.gnu.org; Thu, 25 May 2017 23:50:57 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v4Q3ospj000828; Thu, 25 May 2017 23:50:55 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 0BD98662E6; Thu, 25 May 2017 23:50:54 -0400 (EDT) From: Stefan Monnier To: Rafael D Sorkin Subject: Re: bug#27016: possible bug in `defsetf' Message-ID: References: Date: Thu, 25 May 2017 23:50:54 -0400 In-Reply-To: (Rafael D. Sorkin's message of "Mon, 22 May 2017 02:39:28 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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, RV6034=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6034> : inlines <5884> : streams <1747125> : uri <2432856> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > (unless t > (defalias 'foobar 'cons) > (defsetf foobar setcar)) ; nil > (foobar pair) ; same as above > (setf (foobar pair) 0) ; 0 ! I can confirm that it's a bug. It's perfectly correct for the defsetf to be macroexpanded, but not to be evaluated. Not sure how best to get that behavior. The naive/straightforward way might be to introduce some sort of eval-and-compile-when-at-toplevel, but there's probably a better way. The first thing to do is to look at how it was done in Emacs-23. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri May 26 01:05:23 2017 Received: (at 27016) by debbugs.gnu.org; 26 May 2017 05:05:23 +0000 Received: from localhost ([127.0.0.1]:38450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE7RD-0007JW-Jt for submit@debbugs.gnu.org; Fri, 26 May 2017 01:05:23 -0400 Received: from mail-oi0-f97.google.com ([209.85.218.97]:32993) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dE7RB-0007JH-Nw for 27016@debbugs.gnu.org; Fri, 26 May 2017 01:05:22 -0400 Received: by mail-oi0-f97.google.com with SMTP id b3so47790oii.0 for <27016@debbugs.gnu.org>; Thu, 25 May 2017 22:05:21 -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=Qbnyjp08cpnRbbk2JG7AlO6EX/YUUZG8I1DmSsj+c4A=; b=MumgOkmaPZ7OqGEcpVD6i20Xm7hEi5uqejwGxIXm1VZj6hZeV0q0H4f9SVANsAxeff pHwZd3gO+em5VyGf0AKswPX0tuA4jLfIO61oAfZsyEzRnN1FKfkTYrxsARKe6BsM6tXd Z43/Vtkvjv0jJFnv/bSUTEnzPaVhg2u9mUO+M= 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=Qbnyjp08cpnRbbk2JG7AlO6EX/YUUZG8I1DmSsj+c4A=; b=LA1jBf88ujjMV0ZtY/Vq/Z34jPxee3cBv7ZB2S5myN5SiDYpIZEXF/Yk6sHAlIQ13H oGodlPhwKJm8QeD34hDxCNkzK/P2JOHo23r+K+JGwNeEiUvCoDJVbKQrkirN69Rc0Uqd xes8cbUgI5ZmFunp3i/uloNojzPoMTrOn5cDZm1sJJlbJNlRKqT2zrUGVLnxg2mXVff5 GIxg7F4MQBOaljwx3tlGQHGgrB8YDZZfWn8Zz4uCyQXiDVQPC59AURuVh+UrowsqWv3l U4vWWAaAXYHkgseRRkEZN9jAl7rjyNN0w3OB2uWlnriMjW74ZrVdDbGMNRXUKlWb4bUN 2s0A== X-Gm-Message-State: AODbwcANwRmBQClkB2XapdoUF71UGzXXZNRbCNbpzMQrKD9mrTS3ijGE HOSZFRJSHZmhVU989J+8oz/1DmFjlbq/IAvoph4J X-Received: by 10.36.118.12 with SMTP id z12mr1061721itb.47.1495775116017; Thu, 25 May 2017 22:05:16 -0700 (PDT) Received: from mail.perimeterinstitute.ca ([38.104.158.162]) by smtp-relay.gmail.com with ESMTP id r16sm3689744ita.0.2017.05.25.22.05.15; Thu, 25 May 2017 22:05:16 -0700 (PDT) X-Relaying-Domain: perimeterinstitute.ca Received: from mars.pi.local (mars.pi.local [10.10.7.6]) by mail.perimeterinstitute.ca (Postfix) with ESMTPS id 5E5CEC0025; Fri, 26 May 2017 01:14:37 -0400 (EDT) Received: from rsorkin by mars.pi.local with local (Exim 4.69) (envelope-from ) id 1dE7R7-0000sv-KM; Fri, 26 May 2017 01:05:17 -0400 From: Rafael D Sorkin To: Michael Heerdegen Subject: Re: bug#27016: possible bug in `defsetf' X-Mailer: MH-E 8.2; nmh 1.2; GNU Emacs 23.1.1 In-reply-to: your message of Thu, 25 May 2017 22:26:40 +0200 Message-Id: Date: Fri, 26 May 2017 01:05:17 -0400 X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin , npostavs@users.sourceforge.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Rafael D Sorkin Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) > I would rather try something like > > #+begin_src emacs-lisp > (unless t > (eval '(progn (defalias 'foobar 'cons) > (defsetf foobar setcar)))) > #+end_src > > to avoid the eager macro expansion unless the code is actually run. That looks like it would have to work. I will keep it mind in case of future need. Thanks. ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- Rafael Sorkin Perimeter Institute for Theoretical Physics 31 Caroline Street North Waterloo, ON N2L 2Y5 Canada ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- From debbugs-submit-bounces@debbugs.gnu.org Fri May 26 18:49:54 2017 Received: (at 27016) by debbugs.gnu.org; 26 May 2017 22:49:54 +0000 Received: from localhost ([127.0.0.1]:39677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEO3O-0000eO-KZ for submit@debbugs.gnu.org; Fri, 26 May 2017 18:49:54 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:34042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dEO3L-0000e5-BA; Fri, 26 May 2017 18:49:52 -0400 Received: by mail-it0-f68.google.com with SMTP id d68so2723726ita.1; Fri, 26 May 2017 15:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=DET72faV0Ho7YqI9Z/4EA5jWo84nXldl/y8aLj7LCFk=; b=WaFcu/Uw/OnP7GWFwaEK8ICRUwOT8glwbbc5hlAUpEpf/3wDQiTCegFBd3m3rHHlCY XIQ4ZrnIivCBYOVT0WTZ5fBYSuEaVhHzkISUcww83movMr0Y0g90Ih8j0rWrflgPy7YK tbQ0gWXQob+9L82Zaw96lcr1R84nSJk/kJlFcFR+NJa+V4AaZzNa6kjuvdAWUzBFlj8q AnjxEL7SYFFkD193BdvL7Y8E/VgER36Qkqt21LpXSwFnzyviF8kVE0G3W9xskcymtwWF dY5J3j5ABiLwHqZpNjEIr0wYX7EIK/EkRpSDxFoKzqbo0/+BGnf5aIfy8YknIbPhibbA Wcdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=DET72faV0Ho7YqI9Z/4EA5jWo84nXldl/y8aLj7LCFk=; b=U5zPDJ91aOSld/lnb1Rf5VNxXYxOg1ynLzgPg5ledwCcLbjxf4JekCGdQRpY33HKl8 9ylQsLgwe6yHMV4JJp89qnTx7dwyFhofSg8ucXUxJs+RPWbm0mDEpZV8uNgLYa/Ob+Co qGLhrhN/lubtfKYksPAO3EfcpSWV7qQy5hEUZuGT9nzgx80iTPIAoEdcvIJBtDyrKXA2 vhlxZSsd1hCphcpV02ODqQwdnHtiWjFrTf6szJvG5nydddzH7ugECdwHqSQ1gnBUUH+D vgmLH4r8nPTedwwq1Xg1qxuvnFLhoFOCwf7wFxV94HPR/DwQsFeiSl7i5iLNPFg3wk11 FPPQ== X-Gm-Message-State: AODbwcBcjnoIEnDZxuxGYyAsg1rsfqBgUME7Z84mbV5M0VhWDSt3sAB3 189aT3/IIYlDO4R1 X-Received: by 10.36.245.132 with SMTP id k126mr19809803ith.43.1495838985432; Fri, 26 May 2017 15:49:45 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id i6sm5020785iti.20.2017.05.26.15.49.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 May 2017 15:49:44 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stefan Monnier Subject: Re: bug#27016: possible bug in `defsetf' References: Date: Fri, 26 May 2017 18:51:21 -0400 In-Reply-To: (Stefan Monnier's message of "Thu, 25 May 2017 23:50:54 -0400") Message-ID: <87h9075j12.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) reopen 27016 tag 27016 - wontfix quit Stefan Monnier writes: >> (unless t >> (defalias 'foobar 'cons) >> (defsetf foobar setcar)) ; nil >> (foobar pair) ; same as above >> (setf (foobar pair) 0) ; 0 ! > > I can confirm that it's a bug. It's perfectly correct for the defsetf > to be macroexpanded, but not to be evaluated. > Not sure how best to get that behavior. The naive/straightforward way > might be to introduce some sort of eval-and-compile-when-at-toplevel, > but there's probably a better way. The first thing to do is to look at > how it was done in Emacs-23. Is the difference in Emacs-23 not just eager macroexpansion? Both the Emacs-23 and the current code seem to expand to (put 'foobar ...). From unknown Fri Jun 20 19:51:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: Did not alter fixed versions and reopened. Date: Fri, 26 May 2017 22:50:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # Did not alter fixed versions and reopened. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Sun May 28 16:45:43 2017 Received: (at 27016) by debbugs.gnu.org; 28 May 2017 20:45:43 +0000 Received: from localhost ([127.0.0.1]:42130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dF54J-0001Ti-Dd for submit@debbugs.gnu.org; Sun, 28 May 2017 16:45:43 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:12342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dF54H-0001TW-NB for 27016@debbugs.gnu.org; Sun, 28 May 2017 16:45:42 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BuPgAoNitZ/weIs2tdHAEBBAEBCgEBg1WFE4VahX+QbysBlU6CDoYeBAICgwlJDwECAQEBAQEBAWsohRkBBAFWIwULCzQSFBgNilkIrXGLQwEBAQcCJotghTWFJgWeI5UWAYkMhnyUTkgBDoEKMCEIMIdkJIpEAQEB X-IPAS-Result: A0BuPgAoNitZ/weIs2tdHAEBBAEBCgEBg1WFE4VahX+QbysBlU6CDoYeBAICgwlJDwECAQEBAQEBAWsohRkBBAFWIwULCzQSFBgNilkIrXGLQwEBAQcCJotghTWFJgWeI5UWAYkMhnyUTkgBDoEKMCEIMIdkJIpEAQEB X-IronPort-AV: E=Sophos;i="5.38,411,1491278400"; d="scan'208";a="313784434" Received: from 107-179-136-7.cpe.teksavvy.com (HELO milanesa.home) ([107.179.136.7]) by smtp.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 May 2017 16:45:34 -0400 Received: by milanesa.home (Postfix, from userid 20848) id 0A9CB660D7; Sun, 28 May 2017 16:45:35 -0400 (EDT) From: Stefan Monnier To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' Message-ID: References: <87h9075j12.fsf@users.sourceforge.net> Date: Sun, 28 May 2017 16:45:35 -0400 In-Reply-To: <87h9075j12.fsf@users.sourceforge.net> (npostavs's message of "Fri, 26 May 2017 18:51:21 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Is the difference in Emacs-23 not just eager macroexpansion? Could be. But I'm more worried about the byte-compiled case. > Both the Emacs-23 and the current code seem to expand to (put 'foobar > ...). Beware: there's macro-expansion and then there's macro-expansion. [ See byte-compile-macro-environment. ] Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 02 16:46:11 2017 Received: (at 27016) by debbugs.gnu.org; 2 Jul 2017 20:46:11 +0000 Received: from localhost ([127.0.0.1]:49110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRlkw-0008Cc-RR for submit@debbugs.gnu.org; Sun, 02 Jul 2017 16:46:11 -0400 Received: from mail-io0-f175.google.com ([209.85.223.175]:35833) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRlku-0008CQ-Bz for 27016@debbugs.gnu.org; Sun, 02 Jul 2017 16:46:08 -0400 Received: by mail-io0-f175.google.com with SMTP id h134so45881729iof.2 for <27016@debbugs.gnu.org>; Sun, 02 Jul 2017 13:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=CYyEGGs81Veor4s5T23NHgoo1O8xeAlKGFu6APacGMA=; b=b75kZFxuTU6+zeL1nDcJggq7rF8nG4maGRZzfg/zOK81pTCHKBsumUZkZ0I9rqmyt2 7QobtFnka6jMciElTytJ2Sq2jRT3eYvJcbaFQuhyVpCxz2AaKoYalh02AtoSd9DgsxYC 7iWqvMKifI0jMko4aHUYFNj0FIUkECBpOde/wHlKWSiuTHeFaRkLEimTsHVITaT084nm NoMhTQkD7ICFezJlJJFpWGcsjFlvrVa0qTvBG2GMkEcEvL09jYSETBbe8kyKSMrVrcRy K75s5Imje/QZHJZBiNRFo2i8Q7mLcpjQojWvdAdYZgtHWb6SpC5BD8WabUsaqD+anvBa /yzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=CYyEGGs81Veor4s5T23NHgoo1O8xeAlKGFu6APacGMA=; b=hE3Dk2H3B3Dweo0znGjcjNmlMk5ADWrdhooS6uG1gT+A1GualH4A54/+TJ5Um9fm5P 7Wls0WtO2wtvEIED8cPzrTOBMINjqnuAHaaY0mhqxDTr6WEX2oP2a8x9DvOPHg8UyuL2 nbfQl3kLS6njvjmReVVCt0skg5L3/0/IIv/Gk4ewfgoYFt8n6W41GN3eRZ+FcbsiDLR8 Gu/AjT0M6omqIBXrOVofT/pFFa/WYwwwY6GFdKpxBvxGH6IdRHxD5dttGLJCEeNV0iFh gi0Gc3Tw76ihKlw2imjHlS6osTix4XOew+9cY3FWxZDFw+IavDLWNmlMeNVfag/H46wk rBug== X-Gm-Message-State: AKS2vOzjN596fJ/7Gi8dTPOjrhjz082LMxDBDXaIkpJ3Apfh6T7+SYc8 L034qwIqM6k3yQ== X-Received: by 10.107.201.139 with SMTP id z133mr30316023iof.160.1499028362831; Sun, 02 Jul 2017 13:46:02 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 13sm7438234iod.45.2017.07.02.13.45.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 Jul 2017 13:46:00 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stefan Monnier Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> Date: Sun, 02 Jul 2017 16:47:36 -0400 In-Reply-To: (Stefan Monnier's message of "Sun, 28 May 2017 16:45:35 -0400") Message-ID: <87injak1lj.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Stefan Monnier writes: >> Is the difference in Emacs-23 not just eager macroexpansion? > > Could be. But I'm more worried about the byte-compiled case. I hope someone will correct me if I've gotten mixed up again, but I believe the byte-compiled case already works fine: ~/src/emacs$ cat bug-27016-defsetf.el (require 'cl) (defvar pair nil) (setq pair (cons 3 4)) (when nil (defalias 'foobar 'cons) (defsetf foobar setcar)) ~/src/emacs$ emacs -Q -batch -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 =E2=80=98pair=E2= =80=99 lacks a prefix ~/src/emacs$ emacs -Q -batch -l bug-27016-defsetf.elc --eval '(setf (fo= obar pair) 0)' Symbol=E2=80=99s function definition is void: \(setf\ foobar\) From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 03 07:26:25 2017 Received: (at 27016) by debbugs.gnu.org; 3 Jul 2017 11:26:25 +0000 Received: from localhost ([127.0.0.1]:49470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRzUn-0004o3-8C for submit@debbugs.gnu.org; Mon, 03 Jul 2017 07:26:25 -0400 Received: from mout.web.de ([212.227.15.3]:49272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRzUl-0004nn-8j for 27016@debbugs.gnu.org; Mon, 03 Jul 2017 07:26:23 -0400 Received: from drachen.dragon ([92.74.161.87]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lvk56-1dn4cl1w4a-017V63; Mon, 03 Jul 2017 13:25:59 +0200 From: Michael Heerdegen To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> Date: Mon, 03 Jul 2017 13:25:57 +0200 In-Reply-To: <87injak1lj.fsf@users.sourceforge.net> (npostavs's message of "Sun, 02 Jul 2017 16:47:36 -0400") Message-ID: <877ezp4v96.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:Nr/glbRfNasXB6uEjfvS0JF41iSIPwXeFbx1weToX53PQ4TWGa0 EzCnTG2FxMEURq7WbFcdpabGD7CYQI5zOvEkQWahENkTroB4e1QvSCPmlIct+OJsIsY8NDR /TBUEu+SdnstHEcG4NtSWb/7LJkpfmz8Dvv9jmm4cmwG5M8u9K7m4tm001sMI1a6usj9SYd w9RHP3eLcG5Q4VF9uETKg== X-UI-Out-Filterresults: notjunk:1;V01:K0:bNa3V6Jxzok=:BOhNlkE7wxejkHyqCaJUfn RVNIUx/R1N+RR3ur0LfmH10bI+eN9fheKboS8DoZVtEw0UFTwFPKhEYUIqtH5OMtoTJsO6HZn cWWa0l7mDwW9DAcCMcrAmX4abyXHI1lN9h7wivU40A2PYyTEuSPBrFaAdxlFsBHNDT+J7l8SF k9+wMiuTnxipqdsjrlkp6QXBlcHiGdgJA3ZSTo9EqfBYgUkM/mVSy+27y7drnuY0fLA70/1kv c5t547dbJF5gNrgAZpQi+VbTbkMkUHv9WVnxCC/bb5YFpkupo7LotJhS1wD3jManri2EHjC6e BhEKmNHKiHvH0mGUNMKDW7Hh3nW9/v0ULASGNSq0FHL6VcXmw86XGIzGXd2JDoaXOg/+dZma4 p45lJfQUJrRcyvgrJjUsH/3HO33wvQZxggP2MV8z7XGiY2XXtR0RMEcsO21NQtteEz8/i2AZF MyMM+yxJwm+kEMh7GiS8dqerrDiKVkUa66xKOgXyvvchvbLMxyLwKrwmxF7dp9VZUNKJvHxFH ukkoDe+TQk4W3nBEg/jy56fv1wjt2PiDAyX7POX6sA1PoxWXhtgLsyRX3PDpenvkd31ogfUwt 3f8yNSB2ddX39g0rJmNPeKl0uMXSzAI7dpDqUWQgJ4l7X7C9z6R5dk8nrK0PTUhgACpEben4z Ri8210dNRpQJuIoZGvkl8idxDtY2a5zj8yWy3gC79pC+Q1pjtQbN+ndBKhoL3MDB+SrGQHgKr 1PMGuCEvkcHLbPosSNTHiwf7dRDakVBhRrNFabn4VA5Odr26M3YJMTkKv/FOag+/a/nU09y5u 1fQWgN1 X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Stefan Monnier , Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.5 (---) npostavs@users.sourceforge.net writes: > I hope someone will correct me if I've gotten mixed up again, but I > believe the byte-compiled case already works fine: > > ~/src/emacs$ cat bug-27016-defsetf.el > (require 'cl) > > (defvar pair nil) > (setq pair (cons 3 4)) > (when nil > (defalias 'foobar 'cons) > (defsetf foobar setcar)) > ~/src/emacs$ emacs -Q -batch -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 =E2=80=98pair=E2= =80=99 lacks a prefix > ~/src/emacs$ emacs -Q -batch -l bug-27016-defsetf.elc --eval '(setf (= foobar pair) 0)' > Symbol=E2=80=99s function definition is void: \(setf\ foobar\) Yes - if you use two separate Emacs instances. The defsetf gets evaluated in the Emacs that is used to compile the code (unconditionally). So what you state is not suspicious for a problem with a surprising side effect when performing macroexpansion, right? Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 09 16:12:13 2017 Received: (at 27016) by debbugs.gnu.org; 9 Jul 2017 20:12:13 +0000 Received: from localhost ([127.0.0.1]:59192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUIYv-00032Q-1I for submit@debbugs.gnu.org; Sun, 09 Jul 2017 16:12:13 -0400 Received: from mail-it0-f53.google.com ([209.85.214.53]:36100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUIYs-000328-LY; Sun, 09 Jul 2017 16:12:11 -0400 Received: by mail-it0-f53.google.com with SMTP id m68so17316672ith.1; Sun, 09 Jul 2017 13:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=cV7noLiT7dp5SO63FuNGLOhIVoZQcUUqOEaIMqfkNnQ=; b=f2dJ3egyJKI3bAijqt9F8RqMhBGS6RDAuSF+BXc3Q3DOlbGbU8OLeVT2kdhTER/0O0 +zQ7FGF5WPcBh9EZ12d8WWVPvXxTtMmZhH1x4IpzUHXq6bWEiRMcU+39rEpk7oeKN4bG tgIimzpL0dj0S5Rh2JKAD/GXcrAXq70WLC6qGsmQkVynvTIy3D+jheO9u8R1ToNgWI0H bubyjGuoiNN4esR2LykikK92tQ3YyOe6cDb1BwrQjdedgRsdw6ZdKTC32Z5+jiVaiKeK kSbSw/a/jgq+e3svQBSVTeRI2/7462Vp04j87I/3qm1rNnBCT4Zigr1P/YhoRLPRMN5B bYlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=cV7noLiT7dp5SO63FuNGLOhIVoZQcUUqOEaIMqfkNnQ=; b=qUVmod3eZZBC2dvoa0hOwcDDsdROXhUmtGBBAsEOAJwN8p+qClAZq7Axdib9BVroDV Ztydg4nbTucOUPJP9ZCfkACYmVEqQQCHK2JdoNT7+smCmbvUaavnAZOTJr2Zh1G4N1Ua 7qOawXsHYIQBJlDEgVvx+XrGc3Kj1qd+sdqNjQ48f5shmFhIhWGYcQ7A1o2gaWxDD4xq MLSdY0ZamkWeX26/aOVISQ6rrsqcy7RZJWUqSRNvg5S7o2TaGIR8YUtLLKXld8RvQy8f pzPO8yEvrWRPV+YzU6QHLbE1CEHANr748LuD3Vu6keCHlT3LCwN6KGELD7DNrC4julnb 6wfQ== X-Gm-Message-State: AIVw111RU8EVB8rKe+yblrLoayUqmh8z+QT2MwQEzD8eu1YgI65k2Jyx 2izZZndedWdV1nEZ X-Received: by 10.36.2.140 with SMTP id 134mr8349677itu.31.1499631124831; Sun, 09 Jul 2017 13:12:04 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id t18sm2996616ita.25.2017.07.09.13.12.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2017 13:12:03 -0700 (PDT) From: npostavs@users.sourceforge.net To: Michael Heerdegen Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> Date: Sun, 09 Jul 2017 16:13:36 -0400 In-Reply-To: <877ezp4v96.fsf@drachen> (Michael Heerdegen's message of "Mon, 03 Jul 2017 13:25:57 +0200") Message-ID: <871sppgyhb.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Stefan Monnier , Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tags 27016 + patch quit Michael Heerdegen writes: > npostavs@users.sourceforge.net writes: > >> I hope someone will correct me if I've gotten mixed up again, but I >> believe the byte-compiled case already works fine: >> >> ~/src/emacs$ cat bug-27016-defsetf.el >> (require 'cl) >> >> (defvar pair nil) >> (setq pair (cons 3 4)) >> (when nil >> (defalias 'foobar 'cons) >> (defsetf foobar setcar)) >> ~/src/emacs$ emacs -Q -batch -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 =E2=80=98pair= =E2=80=99 lacks a prefix >> ~/src/emacs$ emacs -Q -batch -l bug-27016-defsetf.elc --eval '(setf = (foobar pair) 0)' >> Symbol=E2=80=99s function definition is void: \(setf\ foobar\) > > Yes - if you use two separate Emacs instances. The defsetf gets > evaluated in the Emacs that is used to compile the code > (unconditionally). > > So what you state is not suspicious for a problem with a surprising side > effect when performing macroexpansion, right? Right. ~/src/emacs$ emacs -Q -batch --eval '(byte-compile-file "bug-27016-defs= etf.el")' -l bug-27016-defsetf.elc --eval '(progn (setf (foobar pair) 0) (= print pair))' 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 =E2=80=98pair=E2= =80=99 lacks a prefix (0 . 4) You were indeed correct to point to that FIXME comment in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27016#28 Here's a patch for it: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-define-gv-expanders-in-compiler-session-Bug-27.patch Content-Description: patch >From 1c6585f06ce87b62c505a575661554b6d6b961c8 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 9 Jul 2017 15:56:50 -0400 Subject: [PATCH] Don't define gv expanders in compiler session (Bug#27016) This prevents definitions being compiled from leaking into the current Emacs doing the compilation. * lisp/emacs-lisp/gv.el (gv-define-expander): Push the expander definition into `byte-compile-macro-environment' instead of evaluating at compile time. (gv-get): Check `byte-compile-macro-environment' for gv-expander definitions. --- lisp/emacs-lisp/gv.el | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index c5c12a6414..b916dda731 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -91,7 +91,10 @@ (defun gv-get (place do) ((not (consp place)) (signal 'gv-invalid-place (list place))) (t (let* ((head (car place)) - (gf (function-get head 'gv-expander 'autoload))) + (gf (or (alist-get head (alist-get :gv-expands + (bound-and-true-p + byte-compile-macro-environment))) + (function-get head 'gv-expander 'autoload)))) (if gf (apply gf do (cdr place)) (let ((me (macroexpand-1 place ;; (append macroexpand-all-environment @@ -146,12 +149,15 @@ (defmacro gv-define-expander (name handler) HANDLER is a function which takes an argument DO followed by the same arguments as NAME. DO is a function as defined in `gv-get'." (declare (indent 1) (debug (sexp form))) - ;; 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. - `(eval-and-compile (put ',name 'gv-expander ,handler))) + ;; Push onto `byte-compile-macro-environment' so the method can be + ;; used in the same file as it is defined. + (when (boundp 'byte-compile-macro-environment) + (push (cons :gv-expanders + (cons (cons name handler) + (cdr (assq :gv-expanders + byte-compile-macro-environment)))) + byte-compile-macro-environment)) + `(put ',name 'gv-expander ,handler)) ;;;###autoload (defun gv--defun-declaration (symbol name args handler &optional fix) -- 2.11.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 09 20:26:39 2017 Received: (at 27016) by debbugs.gnu.org; 10 Jul 2017 00:26:39 +0000 Received: from localhost ([127.0.0.1]:59339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUMX9-0002hN-Fc for submit@debbugs.gnu.org; Sun, 09 Jul 2017 20:26:39 -0400 Received: from mout.web.de ([212.227.15.4]:61046) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUMX7-0002hB-Mp for 27016@debbugs.gnu.org; Sun, 09 Jul 2017 20:26:38 -0400 Received: from drachen.dragon ([88.73.234.235]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MEqOg-1dRepW39HG-00G4FF; Mon, 10 Jul 2017 02:26:16 +0200 From: Michael Heerdegen To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> Date: Mon, 10 Jul 2017 02:26:14 +0200 In-Reply-To: <871sppgyhb.fsf@users.sourceforge.net> (npostavs's message of "Sun, 09 Jul 2017 16:13:36 -0400") Message-ID: <87fue5i1cp.fsf@drachen> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:NqzF/gF16HLUDCzqGpz7cBoSC3JeHT9RgA2rHSyhjIdaPpdEWB1 lliR7n6tGIxevB2e/8rfkB5G7IIkVLLdaJJDUBz6IIGXt2IR1vo86KTpUaeX3kvIn4+cdBS CjdnHkeyZJUGqgUVRhC3yIDVbYKiZdxz/OM70scGyviNdX9rjmVN9+dI/+Xl7gvsU5FHgYD EoLLwPyoWw+NmaQGV60ow== X-UI-Out-Filterresults: notjunk:1;V01:K0:bpOGCHPqTnA=:1L87dg4SuWKQX5LwiPVX0S cJjfbAV8E/L0g236oQRs9FVdn7eQeh0PKTCFhlnErmpDd8NxNTy/EIRJ907wLV9wW3etQ37o8 yt+vUnOj8p+5gjJpRYeD5KwLnu4a7EWEzFzyiA71ITxrt5pQaRLgCRMlL6Jmbbr3qxDPD1bbj sG8y8ZpGFArvXXwUPAG0/4zYXEv5ZjoCsZMTSfL0tiGlLkJN0eSkK5bVcz+q7tbkoBucLMB8L h/vwVKBQqS2KAREeamATh0LNdOMF4VXAVUPju7+inagC+ueUZ9NTSsrRrT2mICH0BWaNNlFOy EF1qtKK0y9+SdZ84WaafzYZ6qsvE7PHvTKM5Oyjdo2LuB8OpA/IVboeeWXnD98WWdgIaT/vvA VJnrJ2DAsGYBDIN4YLkCamZR/jbdrhA+Wl38v0FLcbhKa4P57nnvuhPx94qNMFGRXb53+Olsi rXpaXFkB20kDoefjkmuq+EFxXGHFoXmgEf/qv7NRAmihMs/zo3acaXnnT5eC2cOtWCf/qsU0T G/5L3RYdxGCZqhVj46kSvdP8KAzofUFQJ5T/eo4tuBLTWgnhGYBSvYl1g7fCCP/4FBbFjhlkM nn9p8exlN3p79QJM83WQZ6DbZwng+yflGZiBhxoha0Bf+J7vlEYTuXH650B8PQYXPWE1D2Gc5 GFfDYwlV7BG+EpeP/4LwriYrRYiLFKi80kArHwMyYQNzOlPkYB4P9WKOJ4HfnPD/rj9sbeSGV 5SQxqHelRFPr/syKzoqfeh4z1wjLvy+eYIRfCeYRxn76F2EWzGobvHRGCOjReno+mKlTBXAHx pAAabM/ X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Stefan Monnier , Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) npostavs@users.sourceforge.net writes: > Here's a patch for it: [...] Thanks for working on this. AFAIU I think it should work. > @@ -146,12 +149,15 @@ (defmacro gv-define-expander (name handler) > HANDLER is a function which takes an argument DO followed by the same > arguments as NAME. DO is a function as defined in `gv-get'." > (declare (indent 1) (debug (sexp form))) > - ;; 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. > - `(eval-and-compile (put ',name 'gv-expander ,handler))) > + ;; Push onto `byte-compile-macro-environment' so the method can be > + ;; used in the same file as it is defined. > + (when (boundp 'byte-compile-macro-environment) > + (push (cons :gv-expanders > + (cons (cons name handler) > + (cdr (assq :gv-expanders > + byte-compile-macro-environment)))) > + byte-compile-macro-environment)) > + `(put ',name 'gv-expander ,handler)) Is it intended to add an :gv-expanders entry to byte-compile-macro-environment more than once? Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 10 21:43:42 2017 Received: (at 27016) by debbugs.gnu.org; 11 Jul 2017 01:43:42 +0000 Received: from localhost ([127.0.0.1]:33163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUkDG-0006Bv-FD for submit@debbugs.gnu.org; Mon, 10 Jul 2017 21:43:42 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:34159) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUkDE-0006Bj-VV for 27016@debbugs.gnu.org; Mon, 10 Jul 2017 21:43:41 -0400 Received: by mail-it0-f68.google.com with SMTP id o202so912824itc.1 for <27016@debbugs.gnu.org>; Mon, 10 Jul 2017 18:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=+AZHv5SQC/6aWtPToP3ZMCSZ68dQ1Oe9sG0XdfkjQwc=; b=S9YYz2L04TaKprmXgD8zdDeHoHEQ/XBj2xaNnB53iCqTzvQvo2Ch6tfWQrQpgyEHok GKqwmMn9QxJKkIHpk4ZO+MhoL7/yfJnk/Gtr6tf9uULkiZ7OuRgBktUcbU+ORmuv1qnA A3Lk+0dlTmR4FUx6oIAfvYNGTVvxEpZPtRqS8fDqTvKimEZV6KHA7X+SyUG+yMAlAoGM tE96P32f4snU8P15EfuEsejvu8TRLKRtBAG0WuBX9ZGB/BVxx1w7kCEvNKz1zo5wreN+ pSmXGaNNwglSKOe3I674L7xMpEnyEgS/rfNIy6e01DFy9EhUAgL2qAh2XEWsVsg47P2S hunA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=+AZHv5SQC/6aWtPToP3ZMCSZ68dQ1Oe9sG0XdfkjQwc=; b=boesU39kDZPIOHg3HMOa67mRY3zOSPYWM4w7JRm6QUYLqXCM4mzCS5/rFJYb0rf3o1 qDlV011Ft+cUHiU0KFwilFbK5rQGGDD9KX5wyd3IUA+754ShQj6euGrayCvPBwSouSyj YeUqo7Z01PEJM9gSN3Liq7mZFuGHcCx66Ukjox7iUYXBDID3b5qGVjfOfGdIcMcTIREj 2Hmlks425bGjUazoLwQMQ1cTPiO8L9nO7VAJsl7HgvIvIy5pJSyWnldeKHLvMuo5DQ6y JFWnLa2czoatBKKWUHAmaPuQ/VGY9u5SU7VKnzNU9OxejTr7oKH1EL3CreVRDsJkw6Ql jUxQ== X-Gm-Message-State: AIVw111AChR5+Ln82JattwJS2BcWB+O75mFlzLvAhhnK9w6Uj6UGPnD2 FBKxmk66RYIZWA== X-Received: by 10.36.67.9 with SMTP id s9mr13839296itb.6.1499737414406; Mon, 10 Jul 2017 18:43:34 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 95sm7040811ios.36.2017.07.10.18.43.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jul 2017 18:43:33 -0700 (PDT) From: npostavs@users.sourceforge.net To: Michael Heerdegen Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <87fue5i1cp.fsf@drachen> Date: Mon, 10 Jul 2017 21:45:05 -0400 In-Reply-To: <87fue5i1cp.fsf@drachen> (Michael Heerdegen's message of "Mon, 10 Jul 2017 02:26:14 +0200") Message-ID: <87mv8bg31a.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: 27016@debbugs.gnu.org, Stefan Monnier , Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain Michael Heerdegen writes: > Is it intended to add an :gv-expanders entry to > byte-compile-macro-environment more than once? Hmm, not entirely consciously, I was following the same pattern I had used for cl-symbol-macrolet, but in that case we're establishing a let-binding so it's important to be able to pop back to the old binding. It's not needed here though. Also, I had a typo in gv-get (:gv-expands instead of :gv-expanders), because I didn't actually test the positive case. Here's a working(?) version, with tests: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v2-0001-Don-t-define-gv-expanders-in-compiler-session-Bug.patch Content-Description: patch >From b48af25eb5c18cb45d9e431076df767718efa0ec Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 10 Jul 2017 21:42:05 -0400 Subject: [PATCH v2] Don't define gv expanders in compiler session (Bug#27016) This prevents definitions being compiled from leaking into the current Emacs doing the compilation. * lisp/emacs-lisp/gv.el (gv-define-expander): Push the expander definition into `byte-compile-macro-environment' instead of evaluating at compile time. (gv-get): Check `byte-compile-macro-environment' for gv-expander definitions. * test/lisp/emacs-lisp/gv-tests.el: New tests. --- lisp/emacs-lisp/gv.el | 23 ++++++--- test/lisp/emacs-lisp/gv-tests.el | 103 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 test/lisp/emacs-lisp/gv-tests.el diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index c5c12a6414..fa8ae27e1f 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -91,7 +91,10 @@ (defun gv-get (place do) ((not (consp place)) (signal 'gv-invalid-place (list place))) (t (let* ((head (car place)) - (gf (function-get head 'gv-expander 'autoload))) + (gf (or (alist-get head (alist-get :gv-expanders + (bound-and-true-p + byte-compile-macro-environment))) + (function-get head 'gv-expander 'autoload)))) (if gf (apply gf do (cdr place)) (let ((me (macroexpand-1 place ;; (append macroexpand-all-environment @@ -146,12 +149,18 @@ (defmacro gv-define-expander (name handler) HANDLER is a function which takes an argument DO followed by the same arguments as NAME. DO is a function as defined in `gv-get'." (declare (indent 1) (debug (sexp form))) - ;; 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. - `(eval-and-compile (put ',name 'gv-expander ,handler))) + ;; Push onto `byte-compile-macro-environment' so the method can be + ;; used in the same file as it is defined. + (when (boundp 'byte-compile-macro-environment) + (let* ((expanders (assq :gv-expanders byte-compile-macro-environment)) + (expander (assq name (cdr expanders))) + (new-expander (cons name handler))) + (cond (expander (setcdr expander handler)) + (expanders (setcdr expanders (cons new-expander (cdr expanders)))) + (t (setq byte-compile-macro-environment + (cons (cons :gv-expanders (list new-expander)) + byte-compile-macro-environment)))))) + `(put ',name 'gv-expander ,handler)) ;;;###autoload (defun gv--defun-declaration (symbol name args handler &optional fix) diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el new file mode 100644 index 0000000000..affc7ce455 --- /dev/null +++ b/test/lisp/emacs-lisp/gv-tests.el @@ -0,0 +1,103 @@ +;;; gv-tests.el --- tests for gv.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) + +(cl-defmacro gv-tests--in-temp-dir ((elvar elcvar) + (&rest filebody) + &rest body) + (declare (indent 2)) + `(let ((default-directory (make-temp-file "gv-test" t))) + (unwind-protect + (let ((,elvar "gv-test-deffoo.el") + (,elcvar "gv-test-deffoo.elc")) + (with-temp-file ,elvar + (insert ";; -*- lexical-binding: t; -*-\n") + (dolist (form ',filebody) + (pp form (current-buffer)))) + ,@body) + (delete-directory default-directory t)))) + +(ert-deftest gv-define-expander-in-file () + (gv-tests--in-temp-dir (el elc) + ((gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval)) + (defvar gv-test-pair (cons 1 2)) + (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc) + (should (equal (buffer-string) "99\n"))))) + +(ert-deftest gv-dont-define-expander-in-file () + ;; The expander is defined while we are compiling the file, even + ;; though it's inside (when nil ...). + :expected-result :failed + (gv-tests--in-temp-dir (el elc) + ((when nil (gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval))) + (defvar gv-test-pair (cons 1 2)) + (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc) + (should (equal (buffer-string) + "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) + +(ert-deftest gv-define-expander-out-of-file () + (gv-tests--in-temp-dir (el elc) + ((gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval)) + (defvar gv-test-pair (cons 1 2))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc + "--eval" + (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))))) + (should (equal (buffer-string) "99\n"))))) + +(ert-deftest gv-dont-define-expander-other-file () + (gv-tests--in-temp-dir (el elc) + ((if nil (gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval))) + (defvar gv-test-pair (cons 1 2))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc + "--eval" + (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))))) + (should (equal (buffer-string) + "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) + +;;; gv-tests.el ends here -- 2.11.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 11 12:21:47 2017 Received: (at 27016) by debbugs.gnu.org; 11 Jul 2017 16:21:47 +0000 Received: from localhost ([127.0.0.1]:34234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUxv0-0005F4-Qq for submit@debbugs.gnu.org; Tue, 11 Jul 2017 12:21:46 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:35779) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUxuy-0005Ev-9S for 27016@debbugs.gnu.org; Tue, 11 Jul 2017 12:21:45 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6BGLfoC008734; Tue, 11 Jul 2017 12:21:42 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 9F3E5660A6; Tue, 11 Jul 2017 12:21:41 -0400 (EDT) From: Stefan Monnier To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' Message-ID: References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> Date: Tue, 11 Jul 2017 12:21:41 -0400 In-Reply-To: <871sppgyhb.fsf@users.sourceforge.net> (npostavs's message of "Sun, 09 Jul 2017 16:13:36 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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, RV6069=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6069> : inlines <5976> : streams <1753745> : uri <2460791> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > - (gf (function-get head 'gv-expander 'autoload))) > + (gf (or (alist-get head (alist-get :gv-expands > + (bound-and-true-p > + byte-compile-macro-environment))) > + (function-get head 'gv-expander 'autoload)))) I think a better avenue would be to change function-put and function-get to DTRT. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 11 20:54:27 2017 Received: (at 27016) by debbugs.gnu.org; 12 Jul 2017 00:54:27 +0000 Received: from localhost ([127.0.0.1]:34483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dV5v9-00088T-9M for submit@debbugs.gnu.org; Tue, 11 Jul 2017 20:54:27 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:36377) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dV5v7-000884-PT for 27016@debbugs.gnu.org; Tue, 11 Jul 2017 20:54:26 -0400 Received: by mail-io0-f195.google.com with SMTP id h134so777991iof.3 for <27016@debbugs.gnu.org>; Tue, 11 Jul 2017 17:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=FvNQM+XMglSYiifLBFv66nxmTTMLwaZOsA1B7rMxXkE=; b=KId0r8AH/X9wWk5XR00XmV25xk2nFeCiSe+k+oevQviSxEB2nYPzfoLSKgyRQaBtp0 m5I9FkjpPjV3mTwEh0cp8pbWaTEXNegdXJ6zjmmZdk5MDvZ44ksPNIUH497YKjCiFm2A 3dTCbCZEtaZ58oScBwnsvTMrfke35qg6eg3bYlkNfbUMCaZXa59x25F8ADb967OlMC3G Z0VQ4BSG9rFpg6Ikl2fwTPLuq7cOPIO/l22CAcbB3byKSr2SlM5CBtcTtFclMIDeTFxj G55IF1QLMgklY27makZ2VpC1KZVyfar1uMIosI0VIpw5ivWtF6P5WayRzHLei2oDDp/d 5zCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=FvNQM+XMglSYiifLBFv66nxmTTMLwaZOsA1B7rMxXkE=; b=CqQgRpYP0ZvJZtuqYFXzZeagHPYUFR0SIm6TD5IBTs2W1HFTj04DwEHep9hu+0O0gI tcEgblnykKGqPFsAC6W3QyL3Q8WZgL2a+xnt+TW47vALDE1DG2TvQ/zjN8vHDleBt66/ td4jFIi9HWPauFjgwu7DtDz7izmxKxOjfGWoXlDJjzXoW1012L+bOtWT1sVhOKsNTl47 DaBRH8cGtel/coXj8HwMT2Vk1QxnbsG52VwHp2AKF9Pk9USx/KSrHxT3Blm7FYMACGSH 1/xTTfIb5ZFh44EAcydVyZ0GfMkAIO2hZ3WSeG6oMCuj/beeHkTIaXk2ApRvIRP+k5Uu nUJw== X-Gm-Message-State: AIVw112mDBrf8kwwZ+BLjfWqAhnO8wU1VxZpCiYfWjLpE707Gw3v4KSb +1ZXhiTXQPx6Tw== X-Received: by 10.107.134.168 with SMTP id q40mr3095571ioi.149.1499820859969; Tue, 11 Jul 2017 17:54:19 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id r21sm485804ita.16.2017.07.11.17.54.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jul 2017 17:54:19 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stefan Monnier Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> Date: Tue, 11 Jul 2017 20:55:51 -0400 In-Reply-To: (Stefan Monnier's message of "Tue, 11 Jul 2017 12:21:41 -0400") Message-ID: <8760eyfp7s.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Stefan Monnier writes: > I think a better avenue would be to change function-put and function-get > to DTRT. I can see how that might work for function-get: (defun function-get (f prop &optional autoload) ... + (or + (if (eq prop 'gv-expander) + (alist-get f (alist-get :gv-expanders + (bound-and-true-p + byte-compile-macro-environment)))) (let ((val nil)) (while (and (symbolp f) (null (setq val (get f prop))) ;; etc... But how can I make function-put do the right thing for both a macro calling it and keep it's normal role? From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 11 22:01:20 2017 Received: (at 27016) by debbugs.gnu.org; 12 Jul 2017 02:01:20 +0000 Received: from localhost ([127.0.0.1]:34510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dV6xs-0003Sr-6H for submit@debbugs.gnu.org; Tue, 11 Jul 2017 22:01:20 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:46251) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dV6xp-0003Sg-JP for 27016@debbugs.gnu.org; Tue, 11 Jul 2017 22:01:18 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6C21EHf004854; Tue, 11 Jul 2017 22:01:15 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 6E3FE660B0; Tue, 11 Jul 2017 22:01:14 -0400 (EDT) From: Stefan Monnier To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' Message-ID: References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> Date: Tue, 11 Jul 2017 22:01:14 -0400 In-Reply-To: <8760eyfp7s.fsf@users.sourceforge.net> (npostavs's message of "Tue, 11 Jul 2017 20:55:51 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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, RV6069=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6069> : inlines <5977> : streams <1753803> : uri <2461074> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > I can see how that might work for function-get: > > (defun function-get (f prop &optional autoload) > ... > + (or > + (if (eq prop 'gv-expander) > + (alist-get f (alist-get :gv-expanders > + (bound-and-true-p > + byte-compile-macro-environment)))) > (let ((val nil)) > (while (and (symbolp f) > (null (setq val (get f prop))) > ;; etc... Why limit this to `gv-expander`? Also, we should probably move the test within the subsequent `while` loop, so that it interacts correctly with aliases. > But how can I make function-put do the right thing for both a macro > calling it and keep it's normal role? I don't know what to do when a macro calls it (I can't think of any reason we'd want to do that), but I know how to handle the case where a macro outputs code that uses it: Add (byte-defop-compiler-1 function-put) as well as a byte-compile-function-put function. See byte-compile-autoload and byte-compile-make-obsolete-variable for examples. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 13 00:44:56 2017 Received: (at 27016) by debbugs.gnu.org; 13 Jul 2017 04:44:56 +0000 Received: from localhost ([127.0.0.1]:36090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVVzj-0002bx-TN for submit@debbugs.gnu.org; Thu, 13 Jul 2017 00:44:56 -0400 Received: from mail-it0-f52.google.com ([209.85.214.52]:37284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVVzh-0002bj-7z for 27016@debbugs.gnu.org; Thu, 13 Jul 2017 00:44:53 -0400 Received: by mail-it0-f52.google.com with SMTP id m84so32867626ita.0 for <27016@debbugs.gnu.org>; Wed, 12 Jul 2017 21:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=AYCPDTcFY6f6ugrymaaY7G18ftI+MLhZsVHqW0XT1d0=; b=lricbqiavf6bLV3OVgMRlJmRYQdJJm5W56Dg3PDG4W/uNYzoH3XtGLZW5apTHXVmaO /KXlGq+zSbecKbhdRDW7uTQKSvmLH4UlpBHu4vLipBchZA/STaPFL3T3EP4a+Tca383H 9e7eFxCg4IHuWGk+28tzP0PMFFrVbJVKocuWRpTPdrCUdPAm7wr5bA9ZIxGRXxFmIRC1 6uxZjnCqFrZggW+fqPmCkWDCesZemOxdzWhJ9R6TBVsHL3ZhdAXn3pHidgRcGC0RR+YQ bV2bjpBbMgDGsfzHM+FOsyrNcC9RtD4TF7byixRHxuRgceKrRDWbH2Ot82UGRQdS6fUM t12A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=AYCPDTcFY6f6ugrymaaY7G18ftI+MLhZsVHqW0XT1d0=; b=MgTNeKG7AwYPxd7CmMAv3AC4haV0v18DyTGBidF9A1V9nClrNRJstF7ZYe4wdWr655 5IAM/AVOfja7JT7Befbh0RF7rXeyEX4zw9TgofunNLy/hHtQ/+ZvRT1IYm1YwlRrPmby M02jNvBndr0FVivShFmNT1Qou0m/gRKiqJ9ID28zMEA0zYeD8S7QgS3PPpUJUKl0HbJT fspsWOFAr6V4gpq/+GbGYoFz4ah4nau2QzLyOAs+JjkRw9x3FwLaEg0ioVm8nA9Rtqxd 8m75t6wCHu7oIzM2hhEm2uonPk2Tz16RKE24EGKpaVNtnloZfSNPTFx5kKOIwJe8l45L +SrQ== X-Gm-Message-State: AIVw112SunKXqN97EKCJ1lHomhW4GOkL9BZsT3nYHhrBybDKjOjf7zb7 mnbB7w+zW0hsQg== X-Received: by 10.36.110.23 with SMTP id w23mr26270659itc.24.1499921087308; Wed, 12 Jul 2017 21:44:47 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id b17sm428906itd.0.2017.07.12.21.44.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Jul 2017 21:44:45 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stefan Monnier Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> Date: Thu, 13 Jul 2017 00:46:18 -0400 In-Reply-To: (Stefan Monnier's message of "Tue, 11 Jul 2017 22:01:14 -0400") Message-ID: <87a849djvp.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain Stefan Monnier writes: > I don't know what to do when a macro calls it (I can't think of any > reason we'd want to do that), but I know how to handle the case where > a macro outputs code that uses it: Add (byte-defop-compiler-1 > function-put) as well as a byte-compile-function-put function. > See byte-compile-autoload and byte-compile-make-obsolete-variable > for examples. Oh, I think I get it now. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v3-0001-Let-function-put-affect-compilation-of-the-curren.patch Content-Description: patch >From 565dd64e74b78f56982bd7ca92f34ab71e6d669a Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 13 Jul 2017 00:40:35 -0400 Subject: [PATCH v3 1/2] Let `function-put' affect compilation of the current file * lisp/emacs-lisp/bytecomp.el (byte-compile-plist-environment): New variable. (byte-compile-close-variables): Let-bind it to nil. (byte-compile-function-put): New byte-defop-compiler. * lisp/subr.el (function-get): Consult `byte-compile-plist-environment'. --- lisp/emacs-lisp/bytecomp.el | 18 ++++++++++++++++++ lisp/subr.el | 7 ++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e5b9b47b1d..028efbce26 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -498,6 +498,10 @@ (defvar byte-compile-macro-environment byte-compile-initial-macro-environment Each element looks like (MACRONAME . DEFINITION). It is \(MACRONAME . nil) when a macro is redefined as a function.") +(defvar byte-compile-plist-environment nil + "Alist of property lists defined in the file being compiled. +Each element looks like (SYMBOL . PLIST).") + (defvar byte-compile-function-environment nil "Alist of functions defined in the file being compiled. This is so we can inline them when necessary. @@ -1585,6 +1589,7 @@ (defmacro byte-compile-close-variables (&rest body) ;; macroenvironment. (copy-alist byte-compile-initial-macro-environment)) (byte-compile--outbuffer nil) + (byte-compile-plist-environment nil) (byte-compile-function-environment nil) (byte-compile-bound-variables nil) (byte-compile-lexical-variables nil) @@ -4577,6 +4582,7 @@ (byte-defop-compiler-1 defvar) (byte-defop-compiler-1 defconst byte-compile-defvar) (byte-defop-compiler-1 autoload) (byte-defop-compiler-1 lambda byte-compile-lambda-form) +(byte-defop-compiler-1 function-put) ;; If foo.el declares `toto' as obsolete, it is likely that foo.el will ;; actually use `toto' in order for this obsolete variable to still work @@ -4725,6 +4731,18 @@ (put 'make-variable-buffer-local 'byte-hunk-handler 'byte-compile-form-make-variable-buffer-local) (defun byte-compile-form-make-variable-buffer-local (form) (byte-compile-keep-pending form 'byte-compile-normal-call)) + +(defun byte-compile-function-put (form) + (pcase form + (`(,_ (,(or 'quote 'function) ,(and fun (guard (symbolp fun)))) + ',prop ,(or `#',value (and value (guard (functionp value))))) + (let ((fplist (assq fun byte-compile-plist-environment))) + (if fplist + (setcdr fplist (plist-put (cdr fplist) prop value)) + (push (cons fun (list prop value)) + byte-compile-plist-environment))))) + (byte-compile-normal-call form)) + ;;; tags diff --git a/lisp/subr.el b/lisp/subr.el index 42b4e1c211..3e4a3dedf5 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2971,7 +2971,12 @@ (defun function-get (f prop &optional autoload) if it's an autoloaded macro." (let ((val nil)) (while (and (symbolp f) - (null (setq val (get f prop))) + (null (setq val (or (plist-get + (alist-get + f (bound-and-true-p + byte-compile-plist-environment)) + prop) + (get f prop)))) (fboundp f)) (let ((fundef (symbol-function f))) (if (and autoload (autoloadp fundef) -- 2.11.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v3-0002-Don-t-define-gv-expanders-in-compiler-s-runtime-B.patch Content-Description: patch >From bb2165c72cc7fa436ab911ab756cacec6384927d Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 13 Jul 2017 00:42:38 -0400 Subject: [PATCH v3 2/2] Don't define gv expanders in compiler's runtime (Bug#27016) This prevents definitions being compiled from leaking into the current Emacs doing the compilation. * lisp/emacs-lisp/gv.el (gv-define-expander): Use function-put instead of `put' with `eval-and-compile'. * test/lisp/emacs-lisp/gv-tests.el: New tests. --- lisp/emacs-lisp/gv.el | 7 +-- test/lisp/emacs-lisp/gv-tests.el | 103 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 test/lisp/emacs-lisp/gv-tests.el diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index c5c12a6414..54105f89af 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -146,12 +146,7 @@ (defmacro gv-define-expander (name handler) HANDLER is a function which takes an argument DO followed by the same arguments as NAME. DO is a function as defined in `gv-get'." (declare (indent 1) (debug (sexp form))) - ;; 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. - `(eval-and-compile (put ',name 'gv-expander ,handler))) + `(function-put ',name 'gv-expander ,handler)) ;;;###autoload (defun gv--defun-declaration (symbol name args handler &optional fix) diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el new file mode 100644 index 0000000000..affc7ce455 --- /dev/null +++ b/test/lisp/emacs-lisp/gv-tests.el @@ -0,0 +1,103 @@ +;;; gv-tests.el --- tests for gv.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) + +(cl-defmacro gv-tests--in-temp-dir ((elvar elcvar) + (&rest filebody) + &rest body) + (declare (indent 2)) + `(let ((default-directory (make-temp-file "gv-test" t))) + (unwind-protect + (let ((,elvar "gv-test-deffoo.el") + (,elcvar "gv-test-deffoo.elc")) + (with-temp-file ,elvar + (insert ";; -*- lexical-binding: t; -*-\n") + (dolist (form ',filebody) + (pp form (current-buffer)))) + ,@body) + (delete-directory default-directory t)))) + +(ert-deftest gv-define-expander-in-file () + (gv-tests--in-temp-dir (el elc) + ((gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval)) + (defvar gv-test-pair (cons 1 2)) + (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc) + (should (equal (buffer-string) "99\n"))))) + +(ert-deftest gv-dont-define-expander-in-file () + ;; The expander is defined while we are compiling the file, even + ;; though it's inside (when nil ...). + :expected-result :failed + (gv-tests--in-temp-dir (el elc) + ((when nil (gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval))) + (defvar gv-test-pair (cons 1 2)) + (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc) + (should (equal (buffer-string) + "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) + +(ert-deftest gv-define-expander-out-of-file () + (gv-tests--in-temp-dir (el elc) + ((gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval)) + (defvar gv-test-pair (cons 1 2))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc + "--eval" + (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))))) + (should (equal (buffer-string) "99\n"))))) + +(ert-deftest gv-dont-define-expander-other-file () + (gv-tests--in-temp-dir (el elc) + ((if nil (gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval))) + (defvar gv-test-pair (cons 1 2))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc + "--eval" + (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))))) + (should (equal (buffer-string) + "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) + +;;; gv-tests.el ends here -- 2.11.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 13 10:25:43 2017 Received: (at 27016) by debbugs.gnu.org; 13 Jul 2017 14:25:43 +0000 Received: from localhost ([127.0.0.1]:37218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVf3n-0003RJ-GY for submit@debbugs.gnu.org; Thu, 13 Jul 2017 10:25:43 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:35669) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVf3l-0003R6-S3 for 27016@debbugs.gnu.org; Thu, 13 Jul 2017 10:25:42 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6DEPcV3007572; Thu, 13 Jul 2017 10:25:39 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 496C4660B0; Thu, 13 Jul 2017 10:25:38 -0400 (EDT) From: Stefan Monnier To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' Message-ID: References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> <87a849djvp.fsf@users.sourceforge.net> Date: Thu, 13 Jul 2017 10:25:38 -0400 In-Reply-To: <87a849djvp.fsf@users.sourceforge.net> (npostavs's message of "Thu, 13 Jul 2017 00:46:18 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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, RV6070=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6070> : inlines <5978> : streams <1754016> : uri <2462062> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > Oh, I think I get it now. Looks about right. A few comments below. Stefan > @@ -4577,6 +4582,7 @@ (byte-defop-compiler-1 defvar) > (byte-defop-compiler-1 defconst byte-compile-defvar) > (byte-defop-compiler-1 autoload) > (byte-defop-compiler-1 lambda byte-compile-lambda-form) > +(byte-defop-compiler-1 function-put) > > ;; If foo.el declares `toto' as obsolete, it is likely that foo.el will > ;; actually use `toto' in order for this obsolete variable to still work I know it's not how it's done everywhere now, but I like to put the byte-defop-compiler-1 next to the handler function. > @@ -4725,6 +4731,18 @@ (put 'make-variable-buffer-local > 'byte-hunk-handler 'byte-compile-form-make-variable-buffer-local) > (defun byte-compile-form-make-variable-buffer-local (form) > (byte-compile-keep-pending form 'byte-compile-normal-call)) > + > +(defun byte-compile-function-put (form) > + (pcase form > + (`(,_ (,(or 'quote 'function) ,(and fun (guard (symbolp fun)))) > + ',prop ,(or `#',value (and value (guard (functionp value))))) The value doesn't have to be `functionp` (it is in the case of gv-expander, but it depends on the property). > + (let ((fplist (assq fun byte-compile-plist-environment))) > + (if fplist > + (setcdr fplist (plist-put (cdr fplist) prop value)) > + (push (cons fun (list prop value)) > + byte-compile-plist-environment))))) I'd just unconditionally use `push`: (push (cons fun `(,prop ,value . ,fplist)) byte-compile-plist-environment))))) From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 13 20:38:04 2017 Received: (at 27016) by debbugs.gnu.org; 14 Jul 2017 00:38:04 +0000 Received: from localhost ([127.0.0.1]:37530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVocO-0001FW-5e for submit@debbugs.gnu.org; Thu, 13 Jul 2017 20:38:04 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:36005) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVocL-0001F1-HP for 27016@debbugs.gnu.org; Thu, 13 Jul 2017 20:38:02 -0400 Received: by mail-it0-f43.google.com with SMTP id m68so8367373ith.1 for <27016@debbugs.gnu.org>; Thu, 13 Jul 2017 17:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=qqXXl9upG7++ctMF6xFZCRhFKHnncWmGxmB7z05XriI=; b=c1XVxwf5rOFnliMMwTasZPCncEPuFDiSnwofLVng+IiG1Th/vUyJd8z6St/0twWQBU APrngGJhUMhkOxiyzilx01G5EDyeiQGs0AJQ9SoKoU55y1ox6h0Ngq9D6tAg8tnUNdVb 4judwETKQfYHnQ2eE9iQHrjLHND5rIXZJlx7KQAu9RQ3upCrHMpa0DTJN4re8phdNzOO yiEhOSY7f2apFEUvuH+GxeDTyavzUOezGlnMfhZXnMO2r4VO8qD1WO7V7mUdOBMJqz0w qcWmBEsgsvNIvb77hyX4EDjsl8D15JRLCu8/6AmT1DXchFRKB2HdjtVTjR+FB16RVk+2 Kwdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=qqXXl9upG7++ctMF6xFZCRhFKHnncWmGxmB7z05XriI=; b=PVS/b76KPmJE72Eg/mExB8edgPynzX1eaGbwvzDYNgB2RCW+ssxUgdUJ7uL3u7dLDM y4NAr9XQsfSg3j/gYRtyif37SrnqhGfeoyPW5LLJ3XzUd2WO+TzhAKONtzFiqglenki0 1tgWvYDXTfGIJOf1jguXxs3/AEiX/crJMpJCCaNa3YGlzFJDd6JVd8DEqTNLrwLABjN4 /+MaSmWhO7msxwIfq07A9THk5+Bdq9+wuxpAUB6j7tFUyeCxVPwbrJhBhbFPgO41Q5Bz FMnQWXFmxCdbwa/82hOzksFFlvEMqo+58QTakgl4031Iq7O7w86PMKjgEft4lyluTDmy NzsA== X-Gm-Message-State: AIVw113mRbbZ1B8IBQoF8rRIEtk1HlUb7ATe6JFVaBNpC49Bvzd+SExH JGQcoSQKmaGBAA== X-Received: by 10.36.154.67 with SMTP id l64mr1434863ite.87.1499992675635; Thu, 13 Jul 2017 17:37:55 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id d72sm3898121iod.46.2017.07.13.17.37.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 17:37:54 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stefan Monnier Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> <87a849djvp.fsf@users.sourceforge.net> Date: Thu, 13 Jul 2017 20:39:27 -0400 In-Reply-To: (Stefan Monnier's message of "Thu, 13 Jul 2017 10:25:38 -0400") Message-ID: <874lufets0.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Stefan Monnier writes: > Looks about right. Except that it isn't. While compiling map.el, I get ../../emacs-master/lisp/emacs-lisp/map.el:292:1:Error: Symbol=E2=80=99s fun= ction definition is void: internal-make-closure I can fix this with @@ -146,7 +146,7 @@ (defmacro gv-define-expander (name handler) HANDLER is a function which takes an argument DO followed by the same arguments as NAME. DO is a function as defined in `gv-get'." (declare (indent 1) (debug (sexp form))) - `(function-put ',name 'gv-expander ,handler)) + `(function-put ',name 'gv-expander (eval-when-compile ,handler))) But that doesn't look like the right thing. > I know it's not how it's done everywhere now, but I like to put the > byte-defop-compiler-1 next to the handler function. Makes sense. >> +(defun byte-compile-function-put (form) >> + (pcase form >> + (`(,_ (,(or 'quote 'function) ,(and fun (guard (symbolp fun)))) >> + ',prop ,(or `#',value (and value (guard (functionp value))))) > > The value doesn't have to be `functionp` (it is in the case of > gv-expander, but it depends on the property). Right. I got a bit turned around with the quoting levels. And given the error above, I'm still not sure I have it worked out correctly. >> + (let ((fplist (assq fun byte-compile-plist-environment))) >> + (if fplist >> + (setcdr fplist (plist-put (cdr fplist) prop value)) >> + (push (cons fun (list prop value)) >> + byte-compile-plist-environment))))) > > I'd just unconditionally use `push`: > > (push (cons fun `(,prop ,value . ,fplist)) > byte-compile-plist-environment))))) Yeah, that is simpler. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 13 23:48:24 2017 Received: (at 27016) by debbugs.gnu.org; 14 Jul 2017 03:48:24 +0000 Received: from localhost ([127.0.0.1]:37571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVraa-0005kl-FF for submit@debbugs.gnu.org; Thu, 13 Jul 2017 23:48:24 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:56766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVraW-0005ka-BI for 27016@debbugs.gnu.org; Thu, 13 Jul 2017 23:48:23 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6E3mHZf026005; Thu, 13 Jul 2017 23:48:17 -0400 Received: by ceviche.home (Postfix, from userid 20848) id EFEF8660B0; Thu, 13 Jul 2017 23:48:16 -0400 (EDT) From: Stefan Monnier To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' Message-ID: References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> <87a849djvp.fsf@users.sourceforge.net> <874lufets0.fsf@users.sourceforge.net> Date: Thu, 13 Jul 2017 23:48:16 -0400 In-Reply-To: <874lufets0.fsf@users.sourceforge.net> (npostavs's message of "Thu, 13 Jul 2017 20:39:27 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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, RV6071=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6071> : inlines <5978> : streams <1754095> : uri <2462440> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > Except that it isn't. While compiling map.el, I get > > ../../emacs-master/lisp/emacs-lisp/map.el:292:1:Error: Symbol=E2=80=99s f= unction definition is void: internal-make-closure Hmm... yes ... interesting ... I see the problem: byte-compile-function-put receives a form that's been preprocessed. These look very much like Elisp, but fundamentally, they're really just a different intermediate representation, which includes things like `internal-make-closure', so they can't be used as Elisp expressions (e.g. passed to `eval`): they need to be passed through the rest of the compiler before they can be used. I'm not sure yet how best way to solve this. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 14 00:32:37 2017 Received: (at 27016) by debbugs.gnu.org; 14 Jul 2017 04:32:37 +0000 Received: from localhost ([127.0.0.1]:37593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVsHN-0006nk-IZ for submit@debbugs.gnu.org; Fri, 14 Jul 2017 00:32:37 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:40851) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVsHM-0006nc-3n for 27016@debbugs.gnu.org; Fri, 14 Jul 2017 00:32:36 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6E4WYLj003734; Fri, 14 Jul 2017 00:32:34 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 24143660B0; Fri, 14 Jul 2017 00:32:34 -0400 (EDT) From: Stefan Monnier To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' Message-ID: References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> <87a849djvp.fsf@users.sourceforge.net> <874lufets0.fsf@users.sourceforge.net> Date: Fri, 14 Jul 2017 00:32:34 -0400 In-Reply-To: (Stefan Monnier's message of "Thu, 13 Jul 2017 23:48:16 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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, RV6071=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6071> : inlines <5978> : streams <1754100> : uri <2462463> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > I'm not sure yet how best way to solve this. I believe the patch below does the right thing. It's kind of a bummer that we have to byte-compile the function call by hand, tho. I tested it only lightly, so please give it a more thorough testing and then feel free to push it. Stefan diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e5b9b47b1d..e6f90e044b 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -498,6 +498,10 @@ byte-compile-macro-environment Each element looks like (MACRONAME . DEFINITION). It is \(MACRONAME . nil) when a macro is redefined as a function.") +(defvar byte-compile-plist-environment nil + "Alist of property lists defined in the file being compiled. +Each element looks like (SYMBOL . PLIST).") + (defvar byte-compile-function-environment nil "Alist of functions defined in the file being compiled. This is so we can inline them when necessary. @@ -1585,6 +1589,7 @@ byte-compile-close-variables ;; macroenvironment. (copy-alist byte-compile-initial-macro-environment)) (byte-compile--outbuffer nil) + (byte-compile-plist-environment nil) (byte-compile-function-environment nil) (byte-compile-bound-variables nil) (byte-compile-lexical-variables nil) @@ -4695,7 +4700,7 @@ byte-compile-file-form-defalias (if (null fun) (message "Macro %s unrecognized, won't work in file" name) (message "Macro %s partly recognized, trying our luck" name) - (push (cons name (eval fun)) + (push (cons name (eval fun t)) byte-compile-macro-environment))) (byte-compile-keep-pending form)))) @@ -4725,6 +4730,33 @@ byte-compile-make-variable-buffer-local 'byte-hunk-handler 'byte-compile-form-make-variable-buffer-local) (defun byte-compile-form-make-variable-buffer-local (form) (byte-compile-keep-pending form 'byte-compile-normal-call)) + +(put 'function-put 'byte-hunk-handler 'byte-compile-function-put) +(defun byte-compile-function-put (form) + (pcase form + ((and `(,op ,fun ,prop ,val) + (guard (and (macroexp-const-p fun) + (macroexp-const-p prop) + (or (macroexp-const-p val) + ;; Also accept anonymous functions, since + ;; we're at top-level which implies they're + ;; also constants. + (pcase val (`(function (lambda . ,_)) t)))))) + (byte-compile-push-constant op) + (byte-compile-form fun) + (byte-compile-form prop) + (let* ((fun (eval fun t)) + (prop (eval prop t)) + (val (if (macroexp-const-p val) + (eval val t) + (byte-compile-lambda (cadr val))))) + (push (cons fun `(,prop ,val + . ,(assq fun byte-compile-plist-environment))) + byte-compile-plist-environment) + (byte-compile-push-constant val) + (byte-compile-out 'byte-call 3))) + + (_ (byte-compile-keep-pending form)))) ;;; tags From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 10:50:11 2017 Received: (at 27016) by debbugs.gnu.org; 15 Jul 2017 14:50:11 +0000 Received: from localhost ([127.0.0.1]:40482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWOOZ-0007yB-2S for submit@debbugs.gnu.org; Sat, 15 Jul 2017 10:50:11 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:33923) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWOOW-0007xw-3T for 27016@debbugs.gnu.org; Sat, 15 Jul 2017 10:50:09 -0400 Received: by mail-io0-f177.google.com with SMTP id r36so26671709ioi.1 for <27016@debbugs.gnu.org>; Sat, 15 Jul 2017 07:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=mRIJ8V2Eash7b0geNL01Avzr/jvnt+SYbxydGKzIa7w=; b=Agxnt1lPpvjRzk0sxZIbtSUI+95eDNUEAhSLlM1rHJYPtK8jqOiyAIH2LjyrtGAXUa m2Qu68MZY3Q9vG0UNTcE5nd5iX5ujk/+VWGwkZu/9AmE87QMnJkADWnDnjTQG00lS9FQ CpUifmO2lrIEmVQCOXTxCLfls9G6eULFeCXOHsUUQpA6kFi2P/bd6zoQB3+5cli8CKLY T6A4+DfGiEnpzdKrhJ75ANzqVPohG8sIx745lWhUv4A/yLICIwCXUep3DrQ4aRQKFDrH TSHtZJc79caajpnPjJdW179Pq9wjWHt9JP8JBLPHMwbXYSULvIYotKIFbz5V7FUbqyMm 9UiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=mRIJ8V2Eash7b0geNL01Avzr/jvnt+SYbxydGKzIa7w=; b=mEBkAOhFpY8XjiPauA+ekjubUhlrBru+Qyy6X0+PzFKu88WHizce5z4VYE1h1wOS30 AiPkv2GAydTQALn6ZsAqUAkL7Tveel89PlRe1eJM9G5Cl/cNOrgKAU5bzNGHr48TMofJ NAMqYx3c9iUJO2SuVOMr5b9KEqD9boJWHdj+0ewr7uul5EiefZCLhPLOC8+U++Fk8Ju1 M4m7fzwvqNuZrmad8arvv0SdOczyVrZyW8MsiB3J3K/8RXyMNeJDRAR05404XevVsWAe FcTjhe9mQliDxyJEhMNMfzRfKCkw2g0hN6ulE8EtHnAeiiHqMfJockeS4pITQK/60rd+ 0dmw== X-Gm-Message-State: AIVw111FeuHei7VLD7tyje1NNOJKOTSNIUlPdwrxxOVX5mvwG8sx9RXw NuYShgavMGk/Tg== X-Received: by 10.107.53.25 with SMTP id c25mr12257725ioa.123.1500130202178; Sat, 15 Jul 2017 07:50:02 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id w68sm6318867iow.55.2017.07.15.07.50.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2017 07:50:00 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stefan Monnier Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> <87a849djvp.fsf@users.sourceforge.net> <874lufets0.fsf@users.sourceforge.net> Date: Sat, 15 Jul 2017 10:51:34 -0400 In-Reply-To: (Stefan Monnier's message of "Fri, 14 Jul 2017 00:32:34 -0400") Message-ID: <87y3rpda89.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) --=-=-= Content-Type: text/plain Stefan Monnier writes: > @@ -4695,7 +4700,7 @@ byte-compile-file-form-defalias > (if (null fun) > (message "Macro %s unrecognized, won't work in file" name) > (message "Macro %s partly recognized, trying our luck" name) > - (push (cons name (eval fun)) > + (push (cons name (eval fun t)) What does this do? Should it be `lexical-binding' instead of `t'? > + (push (cons fun `(,prop ,val > + . ,(assq fun byte-compile-plist-environment))) That should be alist-get instead of assq. I've fixed that and added a test for it. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v4-0001-Let-function-put-take-effect-during-compilation.patch Content-Description: patch >From 8ae4c8b840070c025fc7a9b24ab7fcff38683191 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 14 Jul 2017 00:32:34 -0400 Subject: [PATCH v4 1/2] Let function-put take effect during compilation * lisp/emacs-lisp/bytecomp.el (byte-compile-plist-environment): New variable. * lisp/emacs-lisp/bytecomp.el (byte-compile--outbuffer): Let-bind it to nil. * lisp/emacs-lisp/bytecomp.el (byte-compile-function-put): New function, handles compilation of top-level `function-put' calls. * lisp/subr.el (function-get): Consult byte-compile-plist-environment. Co-authored-by: Noam Postavsky --- lisp/emacs-lisp/bytecomp.el | 34 +++++++++++++++++++++++++++++++++- lisp/subr.el | 7 ++++++- test/lisp/emacs-lisp/bytecomp-tests.el | 17 +++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index fdd4276e4e..ee474f9527 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -498,6 +498,10 @@ (defvar byte-compile-macro-environment byte-compile-initial-macro-environment Each element looks like (MACRONAME . DEFINITION). It is \(MACRONAME . nil) when a macro is redefined as a function.") +(defvar byte-compile-plist-environment nil + "Alist of property lists defined in the file being compiled. +Each element looks like (SYMBOL . PLIST).") + (defvar byte-compile-function-environment nil "Alist of functions defined in the file being compiled. This is so we can inline them when necessary. @@ -1572,6 +1576,7 @@ (defmacro byte-compile-close-variables (&rest body) ;; macroenvironment. (copy-alist byte-compile-initial-macro-environment)) (byte-compile--outbuffer nil) + (byte-compile-plist-environment nil) (byte-compile-function-environment nil) (byte-compile-bound-variables nil) (byte-compile-lexical-variables nil) @@ -4682,7 +4687,7 @@ (defun byte-compile-file-form-defalias (form) (if (null fun) (message "Macro %s unrecognized, won't work in file" name) (message "Macro %s partly recognized, trying our luck" name) - (push (cons name (eval fun)) + (push (cons name (eval fun t)) byte-compile-macro-environment))) (byte-compile-keep-pending form)))) @@ -4712,6 +4717,33 @@ (put 'make-variable-buffer-local 'byte-hunk-handler 'byte-compile-form-make-variable-buffer-local) (defun byte-compile-form-make-variable-buffer-local (form) (byte-compile-keep-pending form 'byte-compile-normal-call)) + +(put 'function-put 'byte-hunk-handler 'byte-compile-function-put) +(defun byte-compile-function-put (form) + (pcase form + ((and `(,op ,fun ,prop ,val) + (guard (and (macroexp-const-p fun) + (macroexp-const-p prop) + (or (macroexp-const-p val) + ;; Also accept anonymous functions, since + ;; we're at top-level which implies they're + ;; also constants. + (pcase val (`(function (lambda . ,_)) t)))))) + (byte-compile-push-constant op) + (byte-compile-form fun) + (byte-compile-form prop) + (let* ((fun (eval fun t)) + (prop (eval prop t)) + (val (if (macroexp-const-p val) + (eval val t) + (byte-compile-lambda (cadr val))))) + (push `(,fun + . (,prop ,val ,@(alist-get fun byte-compile-plist-environment))) + byte-compile-plist-environment) + (byte-compile-push-constant val) + (byte-compile-out 'byte-call 3))) + + (_ (byte-compile-keep-pending form)))) ;;; tags diff --git a/lisp/subr.el b/lisp/subr.el index a9edff6166..0c7e52c7a7 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2962,7 +2962,12 @@ (defun function-get (f prop &optional autoload) if it's an autoloaded macro." (let ((val nil)) (while (and (symbolp f) - (null (setq val (get f prop))) + (null (setq val (or (plist-get + (alist-get + f (bound-and-true-p + byte-compile-plist-environment)) + prop) + (get f prop)))) (fboundp f)) (let ((fundef (symbol-function f))) (if (and autoload (autoloadp fundef) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index d15bd8b6e6..8ef2ce7025 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -545,6 +545,23 @@ (ert-deftest bytecomp-tests--old-style-backquotes () This functionality has been obsolete for more than 10 years already and will be removed soon. See (elisp)Backquote in the manual."))))))) + +(ert-deftest bytecomp-tests-function-put () + "Check `function-put' operates during compilation." + (should (boundp 'lread--old-style-backquotes)) + (bytecomp-tests--with-temp-file source + (dolist (form '((function-put 'bytecomp-tests--foo 'foo 1) + (function-put 'bytecomp-tests--foo 'bar 2) + (defmacro bytecomp-tests--foobar () + `(cons ,(function-get 'bytecomp-tests--foo 'foo) + ,(function-get 'bytecomp-tests--foo 'bar))) + (defvar bytecomp-tests--foobar 1) + (setq bytecomp-tests--foobar (bytecomp-tests--foobar)))) + (print form (current-buffer))) + (write-region (point-min) (point-max) source nil 'silent) + (byte-compile-file source t) + (should (equal bytecomp-tests--foobar (cons 1 2))))) + ;; Local Variables: ;; no-byte-compile: t ;; End: -- 2.11.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v4-0002-Don-t-define-gv-expanders-in-compiler-s-runtime-B.patch Content-Description: patch >From ee889d6bb0e36d8852ab122cfbcf2782dc12f74e Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 13 Jul 2017 00:42:38 -0400 Subject: [PATCH v4 2/2] Don't define gv expanders in compiler's runtime (Bug#27016) This prevents definitions being compiled from leaking into the current Emacs doing the compilation. * lisp/emacs-lisp/gv.el (gv-define-expander): Use function-put instead of `put' with `eval-and-compile'. * test/lisp/emacs-lisp/gv-tests.el: New tests. --- lisp/emacs-lisp/gv.el | 7 +- test/lisp/emacs-lisp/gv-tests.el | 140 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 test/lisp/emacs-lisp/gv-tests.el diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index c5c12a6414..54105f89af 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -146,12 +146,7 @@ (defmacro gv-define-expander (name handler) HANDLER is a function which takes an argument DO followed by the same arguments as NAME. DO is a function as defined in `gv-get'." (declare (indent 1) (debug (sexp form))) - ;; 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. - `(eval-and-compile (put ',name 'gv-expander ,handler))) + `(function-put ',name 'gv-expander ,handler)) ;;;###autoload (defun gv--defun-declaration (symbol name args handler &optional fix) diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el new file mode 100644 index 0000000000..b15a3de8cc --- /dev/null +++ b/test/lisp/emacs-lisp/gv-tests.el @@ -0,0 +1,140 @@ +;;; gv-tests.el --- tests for gv.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) + +(cl-defmacro gv-tests--in-temp-dir ((elvar elcvar) + (&rest filebody) + &rest body) + (declare (indent 2)) + `(let ((default-directory (make-temp-file "gv-test" t))) + (unwind-protect + (let ((,elvar "gv-test-deffoo.el") + (,elcvar "gv-test-deffoo.elc")) + (with-temp-file ,elvar + (insert ";; -*- lexical-binding: t; -*-\n") + (dolist (form ',filebody) + (pp form (current-buffer)))) + ,@body) + (delete-directory default-directory t)))) + +(ert-deftest gv-define-expander-in-file () + (gv-tests--in-temp-dir (el elc) + ((gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval)) + (defvar gv-test-pair (cons 1 2)) + (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc) + (should (equal (buffer-string) "99\n"))))) + +(ert-deftest gv-define-expander-in-file-twice () + (gv-tests--in-temp-dir (el elc) + ((gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval)) + (defvar gv-test-pair (cons 1 2)) + (setf (gv-test-foo gv-test-pair) 99) + (gv-define-setter gv-test-foo (newval cons) + `(setcdr ,cons ,newval)) + (setf (gv-test-foo gv-test-pair) 42) + (message "%S" gv-test-pair)) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc) + (should (equal (buffer-string) "(99 . 42)\n"))))) + +(ert-deftest gv-dont-define-expander-in-file () + ;; The expander is defined while we are compiling the file, even + ;; though it's inside (when nil ...) because the compiler won't + ;; analyze the conditional. + :expected-result :failed + (gv-tests--in-temp-dir (el elc) + ((when nil (gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval))) + (defvar gv-test-pair (cons 1 2)) + (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc) + (should (equal (buffer-string) + "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) + +(ert-deftest gv-define-expander-in-function () + ;; The expander is not defined while we are compiling the file, the + ;; compiler won't handle gv definitions not at top-level. + :expected-result :failed + (gv-tests--in-temp-dir (el elc) + ((defun foo () + (gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval)) + t) + (defvar gv-test-pair (cons 1 2)) + (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc) + (should (equal (buffer-string) "99\n"))))) + +(ert-deftest gv-define-expander-out-of-file () + (gv-tests--in-temp-dir (el elc) + ((gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval)) + (defvar gv-test-pair (cons 1 2))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc + "--eval" + (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))))) + (should (equal (buffer-string) "99\n"))))) + +(ert-deftest gv-dont-define-expander-other-file () + (gv-tests--in-temp-dir (el elc) + ((if nil (gv-define-setter gv-test-foo (newval cons) + `(setcar ,cons ,newval))) + (defvar gv-test-pair (cons 1 2))) + (with-temp-buffer + (call-process (concat invocation-directory invocation-name) + nil '(t t) nil + "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) + "-l" elc + "--eval" + (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) + (message "%d" (car gv-test-pair))))) + (should (equal (buffer-string) + "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) + +;;; gv-tests.el ends here -- 2.11.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 21:03:29 2017 Received: (at 27016) by debbugs.gnu.org; 16 Jul 2017 01:03:29 +0000 Received: from localhost ([127.0.0.1]:40896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWXy5-0008E0-C2 for submit@debbugs.gnu.org; Sat, 15 Jul 2017 21:03:29 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:41756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dWXy4-0008Dt-EH for 27016@debbugs.gnu.org; Sat, 15 Jul 2017 21:03:28 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6G13Qhm009289; Sat, 15 Jul 2017 21:03:27 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 970C4661DE; Sat, 15 Jul 2017 21:03:26 -0400 (EDT) From: Stefan Monnier To: npostavs@users.sourceforge.net Subject: Re: bug#27016: possible bug in `defsetf' Message-ID: References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> <87a849djvp.fsf@users.sourceforge.net> <874lufets0.fsf@users.sourceforge.net> <87y3rpda89.fsf@users.sourceforge.net> Date: Sat, 15 Jul 2017 21:03:26 -0400 In-Reply-To: <87y3rpda89.fsf@users.sourceforge.net> (npostavs's message of "Sat, 15 Jul 2017 10:51:34 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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, RV6072=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6072> : inlines <5978> : streams <1754363> : uri <2463665> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) >> + (push (cons name (eval fun t)) > What does this do? Should it be `lexical-binding' instead of `t'? Sorry, part of an unrelated experiment. >> + (push (cons fun `(,prop ,val >> + . ,(assq fun byte-compile-plist-environment))) > That should be alist-get instead of assq. Good catch. > + (let* ((fun (eval fun t)) > + (prop (eval prop t)) These should likely be just (eval fun) without the `t` either. Tho it doesn't really matter in any case: all those `eval`s just strip off the quote in front of a sexp and should do the same regardless of lexical-binding. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 07 21:17:07 2017 Received: (at 27016) by debbugs.gnu.org; 8 Aug 2017 01:17:07 +0000 Received: from localhost ([127.0.0.1]:50926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1det8t-0001HW-E0 for submit@debbugs.gnu.org; Mon, 07 Aug 2017 21:17:07 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:35861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1det8r-0001Gt-9D; Mon, 07 Aug 2017 21:17:05 -0400 Received: by mail-it0-f66.google.com with SMTP id r9so1518897ita.3; Mon, 07 Aug 2017 18:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=VNPy6bWpegcQZ6zWUR4ZjQMk0MnoqNQBHcZw+d8MGVc=; b=VY3gEAHQW5pHgUrd32uGiCRXvAXhJ3C9Isd0oIYgO7CsX1CLl8AFqOV/Lj0hH+knkp 47WZgiVO0l4DsWLR0OVT6EbxXdzO8kqEKBEfZneGHU7Eh/Dr3JusPaGAOtz2PixBp2Gi /iCK3yOJuj/Jxu3XWItUj6NpYJTPgLT+kLJDwxeunsAvYBRUUCvPyBH2vKl2S1htvLyZ /eLqvbKLFRzuuKjdeu1fVGNGp288Bq0sLv0MihA99gY7FsYYEJKZHDwjNlLSodZRumR/ u/TAINGKgf7az0f+v2OWlF8I7fZqQnTnCEGapvc4BhXKNGipND0v8zFW/qF9AZNsBLG0 Xbpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=VNPy6bWpegcQZ6zWUR4ZjQMk0MnoqNQBHcZw+d8MGVc=; b=gA25v6LRjLP+ZFVcvIKkEkrja98bDOTUZaEfkcSdwe1BagdL0qMCVrCAaKtCHwLpwI 1KBDUgk0DSYFVyQl7XEDYaeLj/1o+6atFJmfkjuq3T1b5nTZzbRcHNqmY1cl4LTf/C79 SQ/x4gpsIn67mxxQqZrIUGFKmzha18CDI9fSJk/Se2sYSw8N1eoaMnSYAVve0lLGRbTp Qfvnrs5HYudIMzgiU/qnaYm0kk4oGZOOdaSmKv3hh7QLq56Y+4GH7x/Pgq4FeUe68x9U NKjTTamnsHnTAyqax3+vsMvGsI1h/zkcc7IWmvpfA7qR1ioJUOp8BajsYabwJy+jewM7 Pauw== X-Gm-Message-State: AHYfb5hJsTYw5w+gWEWEbLeIc6LdKy+h1YspD0cuQ0NTT7w5ZBCCho9m EW0sMqeJoKGCOsqXixQ= X-Received: by 10.36.111.198 with SMTP id x189mr2882243itb.53.1502155019805; Mon, 07 Aug 2017 18:16:59 -0700 (PDT) Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id y28sm3712582ita.2.2017.08.07.18.16.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2017 18:16:58 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stefan Monnier Subject: Re: bug#27016: possible bug in `defsetf' References: <87h9075j12.fsf@users.sourceforge.net> <87injak1lj.fsf@users.sourceforge.net> <877ezp4v96.fsf@drachen> <871sppgyhb.fsf@users.sourceforge.net> <8760eyfp7s.fsf@users.sourceforge.net> <87a849djvp.fsf@users.sourceforge.net> <874lufets0.fsf@users.sourceforge.net> <87y3rpda89.fsf@users.sourceforge.net> Date: Mon, 07 Aug 2017 21:18:36 -0400 In-Reply-To: (Stefan Monnier's message of "Sat, 15 Jul 2017 21:03:26 -0400") Message-ID: <877eye502b.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 27016 Cc: Michael Heerdegen , 27016@debbugs.gnu.org, Rafael D Sorkin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) tags 27016 fixed close 27016 26.1 quit This should be fix in master now. [1: 79a74568e9]: 2017-08-07 18:54:49 -0400 Don't define gv expanders in compiler's runtime (Bug#27016) http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=79a74568e9166f63a12adb30f54edcd57a6405a3 [2: cc30d77ecd]: 2017-08-07 18:54:49 -0400 Let `define-symbol-prop' take effect during compilation http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=cc30d77ecdd1b9155ade3d0656a84a0839ee2795 From unknown Fri Jun 20 19:51:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 05 Sep 2017 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator