From: Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>
To: 17940@debbugs.gnu.org
Subject: bug#17940: Nitpick: (lambda () (begin)) errors
Date: Sat, 05 Jul 2014 01:39:04 +0300 [thread overview]
Message-ID: <87zjgoda0n.fsf@taylan.uni.cx> (raw)
Disclaimer: this is probably just a nitpick.
On guile-user someone brought up that (lambda () (begin)) errors,
arguably counter-intuitively:
http://lists.gnu.org/archive/html/guile-user/2014-07/msg00005.html
After much investigation over this trivial matter, I found that while
it's compliant with the RnRS (it's unspecified), it means Guile
extends the RnRS grammar in an "unexpected" way. According to R5 and
7RS:
<lambda expression> -> (lambda <formals> <body>)
<body> -> <definition>* <sequence>
<sequence> -> <command>* <expression>
<expression> -> (other stuff) | <derived expression>
<derived expression> -> (other stuff) | (begin <sequence>)
meaning that the "(begin)" in that lambda body can be matched up to
<derived expression>, where it then almost matches the `begin' form
but fails only because in the RnRS grammar it must have at least one
expression (see <sequence> again; this is also reflected in section
4.2.3 where this `begin' form is explained; its template clearly shows
it must have at least one expression operand).
Guile on the other hand *generally* allows the expression-begin to
have zero operands, having it return *unspecified*. So one would
expect it to work here as well, since one expects that this is a small
incremental extension to the RnRS grammar, but that's not the case.
If I'm not mistaken, `expand-body' in psyntax would be the place to
tackle this, and from a quick glance I'm guessing the benefit/effort
ratio for changing this is not very high. :-)
Taylan
next reply other threads:[~2014-07-04 22:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 22:39 Taylan Ulrich Bayirli/Kammer [this message]
2020-03-13 13:08 ` bug#17940: (begin) Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zjgoda0n.fsf@taylan.uni.cx \
--to=taylanbayirli@gmail.com \
--cc=17940@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).