X-Loop: help-debbugs@HIDDEN
Subject: bug#73984: Compiler/interpreter doesn't handle the macro defined after it's used
Resent-From: Artyom Bologov <mail@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Thu, 24 Oct 2024 12:47:01 +0000
Resent-Message-ID: <handler.73984.B.17297739645664 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 73984
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: 73984 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-guile <bug-guile@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.17297739645664
(code B ref -1); Thu, 24 Oct 2024 12:47:01 +0000
Received: (at submit) by debbugs.gnu.org; 24 Oct 2024 12:46:04 +0000
Received: from localhost ([127.0.0.1]:34009 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1t3xE4-0001TI-A6
for submit <at> debbugs.gnu.org; Thu, 24 Oct 2024 08:46:04 -0400
Received: from lists.gnu.org ([209.51.188.17]:53672)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <mail@HIDDEN>) id 1t3xE1-0001Ss-Lf
for submit <at> debbugs.gnu.org; Thu, 24 Oct 2024 08:46:02 -0400
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 <mail@HIDDEN>) id 1t3xDW-0003Fc-O1
for bug-guile@HIDDEN; Thu, 24 Oct 2024 08:45:30 -0400
Received: from layka.disroot.org ([178.21.23.139])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <mail@HIDDEN>) id 1t3xDU-0001fe-Qt
for bug-guile@HIDDEN; Thu, 24 Oct 2024 08:45:30 -0400
Received: from mail01.disroot.lan (localhost [127.0.0.1])
by disroot.org (Postfix) with ESMTP id E6F6225136;
Thu, 24 Oct 2024 14:45:14 +0200 (CEST)
X-Virus-Scanned: SPAM Filter at disroot.org
Received: from layka.disroot.org ([127.0.0.1])
by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP
id jo-XMOip6yH7; Thu, 24 Oct 2024 14:45:14 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aartaka.me; s=mail;
t=1729773914; bh=rjbZqIutqyU+1HFgoejabLKQbIsDJ2/usDRkYbrHcME=;
h=From:To:Subject:Date;
b=lXDwxWeCmpHZ17XmU7ltMzCFvlAR26hZpPpECMex5pfIv12wtEsY2rn5Hyb/isBDw
Zfl5aibX2aD2VNGEupU2p6mEK6UrHV5sTZLiZicMQ6n0tEn74xcJQNzBzhq/zS+x8l
3rtyvqUdEp0eKTiZdKL/xCAN+4+zysFmSqucer3g913TtHY9AYaN75L3+12S3Hxxyj
p0DoDjSJ/UkR/hNY2LIpKnMPQjBhhvjZerC6I2Nj8ZqTe7raNkKOlIyaNJ9LvoCn01
Gq2cZQse6O6/Be5z66XBvV6SHy6/O8GKpY6l7ipVkSxFko6VRfk2+xhsVpucsP75Sw
QdxJtAaIN6oUg==
From: Artyom Bologov <mail@HIDDEN>
Date: Thu, 24 Oct 2024 16:45:11 +0400
Message-ID: <87bjz9mzzc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: none client-ip=178.21.23.139; envelope-from=mail@HIDDEN;
helo=layka.disroot.org
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
--=-=-=
Content-Type: text/plain
Hello y'all,
So I'm working on a project with a moderate amount of macros and some
tangled code paths. Which often means I have non-linear and
hard-to-figure-out inter-dependencies between pieces of code. One of
them bit me today: a macro that was defined after a procedure it was
used in, resulted in an "Unbound variable" error when the procedure was
called. The procedure was called long after the macro was finally
defined, so it shouldn't have been a problem. Find the test file
attached and use it as:
```
GUILE_LOAD_PATH=.:$GUILE_LOAD_PATH guile
scheme@(guile-user)> (use-modules (test))
;;; note: source file ./test.scm
;;; newer than compiled /.../test.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling ./test.scm
;;; test.scm:7:5: warning: possibly unbound variable `a'
;;; test.scm:8:5: warning: possibly unbound variable `b'
;;; compiled /.../test.scm.go
scheme@(guile-user)> (testing)
;; ice-9/boot-9.scm:1685:16: In procedure raise-exception:
;; Unbound variable: a
;; ...
```
--=-=-=
Content-Type: text/plain
Content-Disposition: attachment; filename=test.scm
Content-Description: Scheme file to test forward definition problem
(define-module (test)
#:export-syntax (with-something)
#:export (testing))
(define (testing)
(with-something
((a 1)
(b a))
'hello))
(define-syntax-rule (with-something ((var init) ...) body ...)
(let* ((var init) ...)
(begin body ...)
#t))
--=-=-=
Content-Type: text/plain
The expected behavior is that both "a" and "b" are defined and macro
expanded during compilation, regardless of whether it was defined before
or after use.
I'm not sure if that's a valid bug, but here you go anyway.
Best of love,
--
Artyom Bologov
https://aartaka.me
--=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Artyom Bologov <mail@HIDDEN> Subject: bug#73984: Acknowledgement (Compiler/interpreter doesn't handle the macro defined after it's used) Message-ID: <handler.73984.B.17297739645664.ack <at> debbugs.gnu.org> References: <87bjz9mzzc.fsf@HIDDEN> X-Gnu-PR-Message: ack 73984 X-Gnu-PR-Package: guile Reply-To: 73984 <at> debbugs.gnu.org Date: Thu, 24 Oct 2024 12:47:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-guile@HIDDEN If you wish to submit further information on this problem, please send it to 73984 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 73984: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D73984 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#73984: Compiler/interpreter doesn't handle the macro defined after it's used
Resent-From: "Thompson, David" <dthompson2@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Thu, 24 Oct 2024 14:52:02 +0000
Resent-Message-ID: <handler.73984.B73984.172978148830840 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73984
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: Artyom Bologov <mail@HIDDEN>
Cc: 73984 <at> debbugs.gnu.org
Received: via spool by 73984-submit <at> debbugs.gnu.org id=B73984.172978148830840
(code B ref 73984); Thu, 24 Oct 2024 14:52:02 +0000
Received: (at 73984) by debbugs.gnu.org; 24 Oct 2024 14:51:28 +0000
Received: from localhost ([127.0.0.1]:35875 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1t3zBQ-00081M-4A
for submit <at> debbugs.gnu.org; Thu, 24 Oct 2024 10:51:28 -0400
Received: from mail-qt1-f173.google.com ([209.85.160.173]:50415)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <dthompson2@HIDDEN>) id 1t3zBL-00080y-TI
for 73984 <at> debbugs.gnu.org; Thu, 24 Oct 2024 10:51:26 -0400
Received: by mail-qt1-f173.google.com with SMTP id
d75a77b69052e-46094b68e30so6157071cf.0
for <73984 <at> debbugs.gnu.org>; Thu, 24 Oct 2024 07:50:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=worcester.edu; s=google; t=1729781387; x=1730386187; darn=debbugs.gnu.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=yD9shtIS6Qa2Ksxd6tFxCZmzGUutjij0Je8DAgNMGno=;
b=WGlyce1KmlpsvjANDFkKlPjRGr8MrEisbTpc8S8Tpe5UO/A9v/S85x8IAqYs4Oeyk6
sYZ+PIzyJ2lHcjkUYcFwX1ikYbXtHjZ4PZLL1yq7xqPmwx5kovKeqQNWjCTaadKf3hXt
BG3HuM9/1Fccbr7slHFY+aixPpINEeWIyN6vs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1729781387; x=1730386187;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=yD9shtIS6Qa2Ksxd6tFxCZmzGUutjij0Je8DAgNMGno=;
b=wWzDnltbjx7endEw+O/yJI/8+2kinA8Jw9J5GKbDqrgEGq/XudzIkCq8gWK5M0ApBo
2QGsQghK7pwgD6ap+YUrUEQOuwpewWurjOwqCbdHROnVKP+gQzLxwtmdHrC6Yrd82mg6
A2s6WSLWChM6rt1Km6vdZ0ww4L9ORsYwxXS/tLCdB5lU2kUqeTdDTF+lxNV3+/HbIKsS
pVnQZek84Vhh3b5cBcb+lSxkh3BzqrYaKCOryvoQgdxHfpEf53HWK7R+1zMj6CmUzAUl
PdFMjcxNFSh4tPuNRxm05O2m90O9sv5hM045jn3vnT5sqtRjyuofBzw0kXNoBXVAatiV
2UKg==
X-Gm-Message-State: AOJu0YzCpzZeQpO8iebT/yGxtC+gSBGBPoofzS2pbEL8/qb7rtdALi7y
Zhfz4eAzcgIw8KfTNTVLCAx8G8XJ4SnwUQqecCB6XRxJTVLwpR1HwIwynOgoPu+/qXdfHljn7lZ
xbhLk3L8YVS1ofOPzMdEzFaYNaKWMkzxTcVX0pA==
X-Google-Smtp-Source: AGHT+IEH/u+0ALkUdaDzQhda5aDRaX3I9ksYpWoufVSNOMYxDq30TOLdzuXxjxIFfX86yNn3+YKCvWgR09Qmw/8Rsjw=
X-Received: by 2002:ac8:5f8e:0:b0:461:2616:8490 with SMTP id
d75a77b69052e-4612616859cmr17814391cf.29.1729781387575; Thu, 24 Oct 2024
07:49:47 -0700 (PDT)
MIME-Version: 1.0
References: <87bjz9mzzc.fsf@HIDDEN>
In-Reply-To: <87bjz9mzzc.fsf@HIDDEN>
From: "Thompson, David" <dthompson2@HIDDEN>
Date: Thu, 24 Oct 2024 10:49:36 -0400
Message-ID: <CAJ=Rwfa9mFjzrG-NdJogw6EQdu2XdWvNKWL4MPXDzdjc7WLkdg@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hi Artyom,
On Thu, Oct 24, 2024 at 8:47=E2=80=AFAM Artyom Bologov <mail@HIDDEN> wr=
ote:
>
> Hello y'all,
>
> So I'm working on a project with a moderate amount of macros and some
> tangled code paths. Which often means I have non-linear and
> hard-to-figure-out inter-dependencies between pieces of code. One of
> them bit me today: a macro that was defined after a procedure it was
> used in, resulted in an "Unbound variable" error when the procedure was
> called. The procedure was called long after the macro was finally
> defined, so it shouldn't have been a problem.
I don't think this is a bug. In my experience, macro definitions must
precede uses.
- Dave
X-Loop: help-debbugs@HIDDEN
Subject: bug#73984: Compiler/interpreter doesn't handle the macro defined after it's used
Resent-From: Artyom Bologov <mail@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Thu, 24 Oct 2024 15:14:01 +0000
Resent-Message-ID: <handler.73984.B73984.17297828372441 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73984
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: "Thompson, David" <dthompson2@HIDDEN>
Cc: 73984 <at> debbugs.gnu.org
Received: via spool by 73984-submit <at> debbugs.gnu.org id=B73984.17297828372441
(code B ref 73984); Thu, 24 Oct 2024 15:14:01 +0000
Received: (at 73984) by debbugs.gnu.org; 24 Oct 2024 15:13:57 +0000
Received: from localhost ([127.0.0.1]:35894 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1t3zXA-0000dJ-Kv
for submit <at> debbugs.gnu.org; Thu, 24 Oct 2024 11:13:56 -0400
Received: from layka.disroot.org ([178.21.23.139]:33844)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <mail@HIDDEN>) id 1t3zX8-0000d1-JC
for 73984 <at> debbugs.gnu.org; Thu, 24 Oct 2024 11:13:55 -0400
Received: from mail01.disroot.lan (localhost [127.0.0.1])
by disroot.org (Postfix) with ESMTP id 84FF3252CD;
Thu, 24 Oct 2024 17:13:22 +0200 (CEST)
X-Virus-Scanned: SPAM Filter at disroot.org
Received: from layka.disroot.org ([127.0.0.1])
by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP
id Qrcox9qTD7jZ; Thu, 24 Oct 2024 17:13:21 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aartaka.me; s=mail;
t=1729782801; bh=rxvMlZPg3C+pmq3o8a9HorA/I3ReR9dZGi5azHo3MPQ=;
h=From:To:Cc:Subject:In-Reply-To:References:Date;
b=1H/bfE6ojOQj1FhjrzRLIamMHFWSdRZwLr4VOYE/j1o8FLyp2by6Iwk7nroeAI61q
9sv9e1z4y3thjzaVcwk7uR6eIYE8HV1yJAkx3H1Wpoi84PbWeONiebvHk84OudMu1T
urt/dhIdRtyPyr3XLXbZfC+WpKVxuXt9C872XpvYV8w4Rg7BEC4gIzyrAqsi8fAOE4
fpau4ya5JVcrjttfoYMsMn1sOpdMxiTlmk4pY1czOehnIIv/SKqWAFWooHv/m8kHts
YiMBJISlLTg1RmQUfJWv+12f1VLhjV+M7BCSd2xPJKjUlHl7Am8iR+/c+8A/O3rj7g
dLnBjeKRcWZpg==
From: Artyom Bologov <mail@HIDDEN>
In-Reply-To: <CAJ=Rwfa9mFjzrG-NdJogw6EQdu2XdWvNKWL4MPXDzdjc7WLkdg@HIDDEN>
(David Thompson's message of "Thu, 24 Oct 2024 10:49:36 -0400")
References: <87bjz9mzzc.fsf@HIDDEN>
<CAJ=Rwfa9mFjzrG-NdJogw6EQdu2XdWvNKWL4MPXDzdjc7WLkdg@HIDDEN>
Date: Thu, 24 Oct 2024 19:13:10 +0400
Message-ID: <8734klilfd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hi David,
> I don't think this is a bug. In my experience, macro definitions must
> precede uses.
This is a sane answer too!
Thanks,
--
Artyom Bologov
https://aartaka.me
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.