From: "Linus Björnstam" <linus.internet@fastmail.se>
To: "Damien Mattei" <damien.mattei@gmail.com>,
guile-user <guile-user@gnu.org>
Subject: Re: strange error message in macro
Date: Thu, 01 Jul 2021 10:02:23 +0200 [thread overview]
Message-ID: <939e760a-dfd3-41df-97e8-728c49121b27@www.fastmail.com> (raw)
In-Reply-To: <CADEOade_WNp2jNc13V=WSEfZLWZ7+rYOFtp0Nbw2o=uesxotAQ@mail.gmail.com>
Begin in a Body is spliced into the body. Begin as an expression chain is not spliced, and needs at least one expression.
So: begin in definition context (directly in function bodies and at top-level) can have 0 expressions. Begin in other contexts must have at least one expression.
--
Linus Björnstam
On Thu, 1 Jul 2021, at 09:34, Damien Mattei wrote:
> hello,
> 'begin' complains of 'sequence of zero expressions in form (begin)'
> in:
> scheme@(guile-user)> ($ {x <- 7} {y <- 8} (+ x y))
> While compiling expression:
> Syntax error:
> unknown file:2:0: sequence of zero expressions in form (begin)
> but:
> scheme@(guile-user)> (begin )
> make no error !
> basically $ is a sort of begin macro that call :
> (define-syntax %parse-assignment
> (syntax-rules ()
> ...
>
> if i wrote:
> (define-syntax %parse-assignment
> (syntax-rules (<-)
> there is no more error:
> scheme@(guile-user)> ($ {x <- 7} {y <- 8} (+ x y))
> ;;; <stdin>:5:0: warning: possibly unbound variable `x'
> ;;; <stdin>:5:0: warning: possibly unbound variable `y'
> 15
> result is 15 and good!
>
> i think that the explanation is with syntax-rules parameters not with
> begin that would not accept zero expression in form , so why this strange
> message?
> i suppose i have trouble understanding the behavior and use of syntax-rules
> parameters anyway and can not find any reliable documentation about it.
>
> Damien
>
prev parent reply other threads:[~2021-07-01 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 7:34 strange error message in macro Damien Mattei
2021-07-01 8:02 ` Linus Björnstam [this message]
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=939e760a-dfd3-41df-97e8-728c49121b27@www.fastmail.com \
--to=linus.internet@fastmail.se \
--cc=damien.mattei@gmail.com \
--cc=guile-user@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).