From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#66940: Dynamic scoping is all weird now? Date: Sun, 05 Nov 2023 08:25:45 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38312"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66940@debbugs.gnu.org To: Dave Goel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 05 08:26:48 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qzXWy-0009oY-6O for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Nov 2023 08:26:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qzXWd-0000ik-Ae; Sun, 05 Nov 2023 02:26:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qzXWb-0000iF-Vd for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 02:26:26 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qzXWb-0005zP-Na for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 02:26:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qzXXB-0002Gv-Sn for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 02:27:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Nov 2023 07:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66940 X-GNU-PR-Package: emacs Original-Received: via spool by 66940-submit@debbugs.gnu.org id=B66940.16991691938692 (code B ref 66940); Sun, 05 Nov 2023 07:27:01 +0000 Original-Received: (at 66940) by debbugs.gnu.org; 5 Nov 2023 07:26:33 +0000 Original-Received: from localhost ([127.0.0.1]:36054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzXWi-0002G8-PS for submit@debbugs.gnu.org; Sun, 05 Nov 2023 02:26:33 -0500 Original-Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:52249) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzXWg-0002Fu-Qx for 66940@debbugs.gnu.org; Sun, 05 Nov 2023 02:26:31 -0500 Original-Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-408382da7f0so26013075e9.0 for <66940@debbugs.gnu.org>; Sun, 05 Nov 2023 00:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699169147; x=1699773947; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=nWzShMRrUjgrx2yyvKKJ014se0YnddmaIpHCqCXir+E=; b=ZHZV8h79a32rFOgV5Gypgj3cUhEQNb4OmbhzTS+0obpNoP7f2zox9H+9cy6LYD0C5i 6WZdkr5nJXWXbGf/HpjOmzvCTklPWYjKx1L9Ks7rtq8C3wEdtUD3kIMhchIZRr/qv/Cl dgEyoArJMOrj6hb0L+kk85yhKPb+9JgQMj3b0248SDUXyDe9uGmJ8j3wIDSH+bk0sT1d sl8S/UsXxRfewdCm7Rh+Ojz1hf/Q5CbEj1O9xKpsf/sZOY89l0iSiCYny2edTrDpVe0l u1Hsy172bzXE6llTyqO9edCsma/nRvYoEPsq7JJTn4kurw74LgVI1K7SdfD9FNB72pbm ungg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699169147; x=1699773947; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nWzShMRrUjgrx2yyvKKJ014se0YnddmaIpHCqCXir+E=; b=S2m050jgEGSg+7nUYiLBr1hf+uOQGDb/jKpnzMtPIWuKX5HuYdhOEOB67WwltbYeD3 QCPSg0zDQcHJ3U9mUx/Upr854EAHFEqNCw6VgowNoKRgquIxXyfKpBqJaBv+rhnCju4m itGssg8RAtW1RJuHFmQfHd1uwHFdsVOmI2tVp/C8OLNDsdbgi0VRCueDMe4FcGswbvJy s0wlJAsvlHjSKvxbGNh19HlbBl0ajQMY+RUUOEzWPZgHOuNkYoJUgc3QgIru4c37i582 9ocu3YyHHWCa9bZHEo7BR4Jhp/F6h3jxiu+KLiWnYLcDqq8D8fyeIN2kPd7bTx2cq9xX qF4g== X-Gm-Message-State: AOJu0YzZr+emhyh0hXsPcedVWhnhWZO9YWyEZ4xMp4vb9b7AW38+w7na Dfj3RjfyhxSsG3ImCi1aHTHUQ+ECWa4= X-Google-Smtp-Source: AGHT+IF3Bw+om6RtGVi2shMbNZsVYtu+Xe+p50ASMfjSvx+AYIRomaFPZaRUyepP9QHHlNjUMlQ7pg== X-Received: by 2002:a05:600c:474f:b0:405:359a:c965 with SMTP id w15-20020a05600c474f00b00405359ac965mr21687223wmo.4.1699169147013; Sun, 05 Nov 2023 00:25:47 -0700 (PDT) Original-Received: from Pro.fritz.box (p4fe3a9c5.dip0.t-ipconnect.de. [79.227.169.197]) by smtp.gmail.com with ESMTPSA id p22-20020a05600c419600b00401d8181f8bsm7875680wmh.25.2023.11.05.00.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 00:25:46 -0700 (PDT) In-Reply-To: (Dave Goel's message of "Sun, 5 Nov 2023 01:58:44 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273810 Archived-At: Dave Goel writes: > (defmacro mac() > `(progn > (message "%S" ,ii) > (sit-for 0.1))) > > So, the original macro had a brain-fart basically amounted to returning nil > unconditionally. > In that case, why were we getting that strange error? Don't know exactly what the "strage error" refers to, but maybe a (pp (macrexpand-all ...)) helps? In this case, the result is "(progn (setq lexical-binding nil) (let ((upper-bound 10) (counter 0)) (while (< counter upper-bound) (let ((ii counter)) (defalias 'mac (cons 'macro #'(lambda nil (list 'message \"%S\" ii) (sit-for 0.1)))) (let ((old_ii ii)) (setq ii 33) (mac) (setq ii old_ii))) (setq counter (1+ counter))))) One things that gets kind of more obvious is that defmacro is something "global" in the sense that it sets mac's symbol function. You could moved the defmacro out of the progn somewhere else. Does that help?