From unknown Thu Aug 14 21:54:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21379: datum->syntax chokes on lists of syntax objects Resent-From: taylanbayirli@gmail.com (Taylan Ulrich =?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 30 Aug 2015 08:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21379 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 21379@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14409234785783 (code B ref -1); Sun, 30 Aug 2015 08:32:02 +0000 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/Kammer?=) 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-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 unknown Thu Aug 14 21:54:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21379: datum->syntax chokes on lists of syntax objects Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 02 Sep 2015 01:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21379 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: taylanbayirli@gmail.com (Taylan Ulrich "=?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer?=") Cc: 21379@debbugs.gnu.org Received: via spool by 21379-submit@debbugs.gnu.org id=B21379.144115726218432 (code B ref 21379); Wed, 02 Sep 2015 01:28:02 +0000 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 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-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 unknown Thu Aug 14 21:54:45 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21379: datum->syntax chokes on lists of syntax objects Resent-From: taylanbayirli@gmail.com (Taylan Ulrich =?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 02 Sep 2015 08:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21379 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Mark H Weaver Cc: 21379@debbugs.gnu.org Received: via spool by 21379-submit@debbugs.gnu.org id=B21379.14411825244169 (code B ref 21379); Wed, 02 Sep 2015 08:29:01 +0000 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/Kammer?=) 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-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 unknown Thu Aug 14 21:54:45 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: taylanbayirli@gmail.com (Taylan Ulrich =?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer?=) Subject: bug#21379: closed (Re: bug#21379: datum->syntax chokes on lists of syntax objects) Message-ID: References: <87d1y01yko.fsf@netris.org> <87wpwdgotu.fsf@T420.taylan> X-Gnu-PR-Message: they-closed 21379 X-Gnu-PR-Package: guile Reply-To: 21379@debbugs.gnu.org Date: Wed, 02 Sep 2015 18:13:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1441217583-7067-1" This is a multi-part message in MIME format... ------------=_1441217583-7067-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #21379: datum->syntax chokes on lists of syntax objects which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 21379@debbugs.gnu.org. --=20 21379: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21379 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1441217583-7067-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit 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 ------------=_1441217583-7067-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit 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 --=-=-=-- ------------=_1441217583-7067-1--