GNU bug report logs -
#17940
Nitpick: (lambda () (begin)) errors
Previous Next
To reply to this bug, email your comments to 17940 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#17940
; Package
guile
.
(Fri, 04 Jul 2014 22:40:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Taylan Ulrich Bayirli/Kammer <taylanbayirli <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Fri, 04 Jul 2014 22:40:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Severity set to 'minor' from 'normal'
Request was from
Mark H Weaver <mhw <at> netris.org>
to
control <at> debbugs.gnu.org
.
(Wed, 01 Oct 2014 23:31:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-guile <at> gnu.org
:
bug#17940
; Package
guile
.
(Fri, 13 Mar 2020 13:09:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 17940 <at> debbugs.gnu.org (full text, mbox):
I have run into this also, in writing macros.
My workaround is to always add (if #f #f)
in my forms that allow no expressions in the body.
See second-to-last line below.
(define-syntax sx-match-1
(syntax-rules ()
((_ v (pat exp ...) c1 ...)
(let ((kf (lambda () (sx-match-1 v c1 ...))))
(sxm-sexp v pat (begin (if #f #f) exp ...) (kf))))
((_ v) (error "sx-match: nothing matches"))))
This bug report was last modified 5 years and 94 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.