From unknown Thu Aug 14 17:29:06 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#21379 <21379@debbugs.gnu.org> To: bug#21379 <21379@debbugs.gnu.org> Subject: Status: datum->syntax chokes on lists of syntax objects Reply-To: bug#21379 <21379@debbugs.gnu.org> Date: Fri, 15 Aug 2025 00:29:06 +0000 retitle 21379 datum->syntax chokes on lists of syntax objects reassign 21379 guile submitter 21379 taylanbayirli@gmail.com (Taylan Ulrich Bay=C4=B1rl=C4=B1/Ka= mmer) severity 21379 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 30 04:31:18 2015 Received: (at submit) by debbugs.gnu.org; 30 Aug 2015 08:31:18 +0000 Received: from localhost ([127.0.0.1]:42483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZVy1F-0001VC-Rd for submit@debbugs.gnu.org; Sun, 30 Aug 2015 04:31:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:32806) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZVy1D-0001V4-75 for submit@debbugs.gnu.org; Sun, 30 Aug 2015 04:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZVy1B-0005uh-N9 for submit@debbugs.gnu.org; Sun, 30 Aug 2015 04:31:14 -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,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVy1B-0005uX-Kg for submit@debbugs.gnu.org; Sun, 30 Aug 2015 04:31:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVy1A-0005jH-Ix for bug-guile@gnu.org; Sun, 30 Aug 2015 04:31:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZVy19-0005tE-E8 for bug-guile@gnu.org; Sun, 30 Aug 2015 04:31:12 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:38735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVy19-0005t3-5v for bug-guile@gnu.org; Sun, 30 Aug 2015 04:31:11 -0400 Received: by wicpl12 with SMTP id pl12so2671705wic.1 for ; Sun, 30 Aug 2015 01:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=4SySEFA0Tdkmou2YlI8V/xXED3gHu5NAVWX46xaeDXA=; b=H28zvZuyiPe+VfpoQUYwrTvdWXKsixHq6ybokTf2oGzLMIQcFUK0dwd8vhuLKKrH0p ndnnWNbe3HArG/nZPNOkDl6mSZNJYc0cL7oQ7dUFZikc98411fbcEl+FJp9nZn2ukvqK kPS+TZIxtwk02nzLH/mlihYvgUfvFKr8DmTcHJvojUi8QXdQyDydamBn6/v90+jH0lsX VdXOUxJDjMYnNe8r0Ocj/Kj63YgLkAt0/OGJvY4L6D3t6lt6X2DbZ4cKeeIQZzgtRnWm DhJO9IB+luwQkw9Uz9IyOAnsoQdtZpAiEn9kBhuMWi4YwnbbGbjFCgdyDysEQRZW1qAV ogUQ== X-Received: by 10.194.117.133 with SMTP id ke5mr20504881wjb.116.1440923470610; Sun, 30 Aug 2015 01:31:10 -0700 (PDT) Received: from T420.taylan ([2a02:908:c32:4740:221:ccff:fe66:68f0]) by smtp.gmail.com with ESMTPSA id v9sm16336303wjq.41.2015.08.30.01.31.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 01:31:09 -0700 (PDT) From: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer?=) To: bug-guile@gnu.org Subject: datum->syntax chokes on lists of syntax objects Date: Sun, 30 Aug 2015 10:31:09 +0200 Message-ID: <87wpwdgotu.fsf@T420.taylan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -4.0 (----) --=-=-= Content-Type: text/plain Apparently there's two ways to represent a list syntax object: (datum->syntax #'x '(a b c)) => #(syntax-object (a b c) ((top)) (hygiene guile-user)) i.e. a syntax object vector with a list payload, and #'(a b c) => (#(syntax-object a ((top)) (hygiene guile-user)) #(syntax-object b ((top)) (hygiene guile-user)) #(syntax-object c ((top)) (hygiene guile-user))) i.e. a list of the elements as syntax objects. Syntax-case and syntax->datum work fine with both. But when the latter form is used as the first argument to a datum->syntax call, it leads to an error: --- snip scheme@(guile-user)> (datum->syntax #'(x) '(a b c)) ice-9/psyntax.scm:467:4: In procedure datum->syntax: ice-9/psyntax.scm:467:4: In procedure vector-ref: Wrong type argument in position 1 (expecting vector): (#(syntax-object x ((top)) (hygiene guile-user))) Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> --- snip I think I understand the problem: in case of a list of syntax objects, it's ambiguous which one's environment should be used for the newly created syntax object, so it requires it to be an "immediately wrapped" syntax object instead. (By the way, the psyntax sources actually call that argument 'id', hinting that perhaps it's expected to be an identifier, though the other representation works fine.) I have no clue what's the best way to solve this, but if my understanding is correct, it's a fundamental issue with datum->syntax and not a bug, so here's a documentation patch that tries to explain the limitation. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Amend-datum-syntax-documentation.patch >From 9578ee36ef005f0b96c1d5b120f11c178e341775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?= Date: Sun, 30 Aug 2015 10:24:52 +0200 Subject: [PATCH] Amend datum->syntax documentation. * doc/ref/api-macros.texi (Syntax Case): Mention that the first argument to datum->syntax is invalid if it's a compound syntax object, except when also created with datum->syntax. --- doc/ref/api-macros.texi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/ref/api-macros.texi b/doc/ref/api-macros.texi index c2910a4..9c1f023 100644 --- a/doc/ref/api-macros.texi +++ b/doc/ref/api-macros.texi @@ -618,7 +618,12 @@ But they can, if we explicitly introduce a binding via @code{datum->syntax}. @deffn {Scheme Procedure} datum->syntax for-syntax datum Create a syntax object that wraps @var{datum}, within the lexical context -corresponding to the syntax object @var{for-syntax}. +corresponding to the syntax object @var{for-syntax}. @var{for-syntax} must +either be an identifier, or a syntax object that was also created with +@var{datum->syntax}; other compound syntax objects may be rejected because they +contain identifiers from different lexical contexts, in which case it would be +ambiguous which one's environment should be used for the newly created syntax +object. @end deffn For completeness, we should mention that it is possible to strip the metadata -- 2.5.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 01 21:27:42 2015 Received: (at 21379) by debbugs.gnu.org; 2 Sep 2015 01:27:42 +0000 Received: from localhost ([127.0.0.1]:45520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWwpx-0004nE-So for submit@debbugs.gnu.org; Tue, 01 Sep 2015 21:27:42 -0400 Received: from world.peace.net ([50.252.239.5]:43809) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWwpv-0004n5-Cc for 21379@debbugs.gnu.org; Tue, 01 Sep 2015 21:27:40 -0400 Received: from [10.1.10.32] (helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1ZWwpn-0004yr-Um; Tue, 01 Sep 2015 21:27:32 -0400 From: Mark H Weaver To: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?=22Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer=22?=) Subject: Re: bug#21379: datum->syntax chokes on lists of syntax objects References: <87wpwdgotu.fsf@T420.taylan> Date: Tue, 01 Sep 2015 21:26:53 -0400 In-Reply-To: <87wpwdgotu.fsf@T420.taylan> ("Taylan Ulrich \=\?utf-8\?Q\?\=5C\=22Bay\=C4\=B1rl\=C4\=B1\=2FKammer\=5C\=22\=22's\?\= message of "Sun, 30 Aug 2015 10:31:09 +0200") Message-ID: <87613t8vc2.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21379 Cc: 21379@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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 (/) Hi Taylan, You're right that this is a documentation bug, but the intended restriction is that the first argument to 'datum->syntax' must be an identifier, as specified in section 12.6 of the R6RS library report. In fact, in R6RS, the name of the first formal argument is 'template-id'. 'datum-syntax' can't do its job properly with a list structure containing multiple identifiers, because in general, each of those identifiers may have originated in a different place. taylanbayirli@gmail.com (Taylan Ulrich "Bay=C4=B1rl=C4=B1/Kammer") writes: > From 9578ee36ef005f0b96c1d5b120f11c178e341775 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Taylan=3D20Ulrich=3D20Bay=3DC4=3DB1rl=3DC4=3DB1/Kammer?= =3D > > Date: Sun, 30 Aug 2015 10:24:52 +0200 > Subject: [PATCH] Amend datum->syntax documentation. > > * doc/ref/api-macros.texi (Syntax Case): Mention that the first argument > to datum->syntax is invalid if it's a compound syntax object, except > when also created with datum->syntax. > --- > doc/ref/api-macros.texi | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > > diff --git a/doc/ref/api-macros.texi b/doc/ref/api-macros.texi > index c2910a4..9c1f023 100644 > --- a/doc/ref/api-macros.texi > +++ b/doc/ref/api-macros.texi > @@ -618,7 +618,12 @@ But they can, if we explicitly introduce a binding v= ia @code{datum->syntax}. >=20=20 > @deffn {Scheme Procedure} datum->syntax for-syntax datum > Create a syntax object that wraps @var{datum}, within the lexical context > -corresponding to the syntax object @var{for-syntax}. How about changing the first formal argument name to 'template-id' and changing the words "syntax object" to "identifier"? Thanks! Mark From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 02 04:28:44 2015 Received: (at 21379) by debbugs.gnu.org; 2 Sep 2015 08:28:44 +0000 Received: from localhost ([127.0.0.1]:45905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZX3PP-00015A-MO for submit@debbugs.gnu.org; Wed, 02 Sep 2015 04:28:43 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:35381) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZX3PN-000152-AJ for 21379@debbugs.gnu.org; Wed, 02 Sep 2015 04:28:42 -0400 Received: by wicge5 with SMTP id ge5so31826719wic.0 for <21379@debbugs.gnu.org>; Wed, 02 Sep 2015 01:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=XMOgPCIUedvz5esmCEvz0IpuGe9Lvnc3l5ctfPiWlgo=; b=r9IuYySDVg23obNEMof9LnJp0xC5N+Oyjeiaf1361NsUJHmEtPE8EKjkdRl7QfVeEY S4G7TOMegPP1NOtULk4YWt+c4xq+UWezJz9ibKCF0FSchvTFZJAUr2AvYjJ5aEKEHCkz MWAQqcOx8NgP/cdYEZz+4w7G0qn2wzR+8ldx0pEewn6rO5Tp5OCHrJeXTRcqugn7+u/3 voqvOQkieU8GOyz4P7Ah0NpWSN6zMAAcH3x/tVRW5cAtmiFCLGU5kMgjVtAd10oKS5Zf qhMxdaXHu3vZeXv10BuBH8CHgzeUESkGvwNqCxR+g1cQziwllkpVyeY0qv5feQgcEIzK dLcg== X-Received: by 10.194.119.161 with SMTP id kv1mr37013204wjb.157.1441182520779; Wed, 02 Sep 2015 01:28:40 -0700 (PDT) Received: from T420.taylan ([2a02:908:c32:4740:221:ccff:fe66:68f0]) by smtp.gmail.com with ESMTPSA id o9sm31152266wja.29.2015.09.02.01.28.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 01:28:39 -0700 (PDT) From: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer?=) To: Mark H Weaver Subject: Re: bug#21379: datum->syntax chokes on lists of syntax objects References: <87wpwdgotu.fsf@T420.taylan> <87613t8vc2.fsf@netris.org> Date: Wed, 02 Sep 2015 10:28:39 +0200 In-Reply-To: <87613t8vc2.fsf@netris.org> (Mark H. Weaver's message of "Tue, 01 Sep 2015 21:26:53 -0400") Message-ID: <87egihdy2w.fsf@T420.taylan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21379 Cc: 21379@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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 Mark H Weaver writes: > How about changing the first formal argument name to 'template-id' and > changing the words "syntax object" to "identifier"? > > Thanks! > Mark Sure, updated patch attached. Taylan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Amend-datum-syntax-documentation.patch >From 2ba9474dc8e2a56524d8c6c2f640fb3fb35b2d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?= Date: Sun, 30 Aug 2015 10:24:52 +0200 Subject: [PATCH] Amend datum->syntax documentation. * doc/ref/api-macros.texi (Syntax Case): Make it clear that the first argument to datum->syntax must be an identifier. --- doc/ref/api-macros.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ref/api-macros.texi b/doc/ref/api-macros.texi index c2910a4..a828258 100644 --- a/doc/ref/api-macros.texi +++ b/doc/ref/api-macros.texi @@ -616,9 +616,9 @@ won't have access to the binding of @code{it}. But they can, if we explicitly introduce a binding via @code{datum->syntax}. -@deffn {Scheme Procedure} datum->syntax for-syntax datum +@deffn {Scheme Procedure} datum->syntax template-id datum Create a syntax object that wraps @var{datum}, within the lexical context -corresponding to the syntax object @var{for-syntax}. +corresponding to the identifier @var{template-id}. @end deffn For completeness, we should mention that it is possible to strip the metadata -- 2.5.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 02 14:12:35 2015 Received: (at 21379-done) by debbugs.gnu.org; 2 Sep 2015 18:12:35 +0000 Received: from localhost ([127.0.0.1]:46707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZXCWR-0001pJ-E9 for submit@debbugs.gnu.org; Wed, 02 Sep 2015 14:12:35 -0400 Received: from world.peace.net ([50.252.239.5]:45232) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZXCWP-0001pB-Hq for 21379-done@debbugs.gnu.org; Wed, 02 Sep 2015 14:12:33 -0400 Received: from [10.1.10.32] (helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1ZXCVZ-0000rA-4h; Wed, 02 Sep 2015 14:11:41 -0400 From: Mark H Weaver To: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?=22Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer=22?=) Subject: Re: bug#21379: datum->syntax chokes on lists of syntax objects References: <87wpwdgotu.fsf@T420.taylan> <87613t8vc2.fsf@netris.org> <87egihdy2w.fsf@T420.taylan> Date: Wed, 02 Sep 2015 14:11:03 -0400 In-Reply-To: <87egihdy2w.fsf@T420.taylan> ("Taylan Ulrich \=\?utf-8\?Q\?\=5C\=22Bay\=C4\=B1rl\=C4\=B1\=2FKammer\=5C\=22\=22's\?\= message of "Wed, 02 Sep 2015 10:28:39 +0200") Message-ID: <87d1y01yko.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21379-done Cc: 21379-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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 (/) taylanbayirli@gmail.com (Taylan Ulrich "Bay=C4=B1rl=C4=B1/Kammer") writes: > From 2ba9474dc8e2a56524d8c6c2f640fb3fb35b2d14 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Taylan=3D20Ulrich=3D20Bay=3DC4=3DB1rl=3DC4=3DB1/Kammer?= =3D > > Date: Sun, 30 Aug 2015 10:24:52 +0200 > Subject: [PATCH] Amend datum->syntax documentation. Pushed with minor changes: I changed "Amend" to "Clarify" in the summary line, and updated the copyright dates in api-macros.texi. Thanks! Mark From unknown Thu Aug 14 17:29:06 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 01 Oct 2015 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