From: Ian Price <ianprice90@googlemail.com>
To: Tobias Brandt <tob.brandt@googlemail.com>
Cc: 10246@debbugs.gnu.org
Subject: bug#10246: R6RS library form broken?
Date: Wed, 07 Dec 2011 23:00:59 +0000 [thread overview]
Message-ID: <877h28aswk.fsf@Kagami.home> (raw)
In-Reply-To: <CAOOWqip0SfWBWi8hmMTJ0oKqMO4SR5SX9A1ACETf5z8v=_xL0g@mail.gmail.com> (Tobias Brandt's message of "Wed, 7 Dec 2011 18:53:59 +0100")
Tobias Brandt <tob.brandt@googlemail.com> writes:
> Declaring a R6RS style library doesn't work:
>
> (library (foo))
>
> =>
> ice-9/psyntax.scm:1422:30: In procedure expand-macro:
> ice-9/psyntax.scm:1422:30: Syntax error:
> source expression failed to match any pattern in form (library (foo))
>
>
> while this does:
>
> (define-module (foo))
This is a misunderstanding on your part, I'm afraid. R6RS library forms
are intended to wrap the code[0]; they are not declarations to be placed at
the top. The manual does mention this[1], by noting the syntax for library
is
(library name (export export-spec ...) (import import-spec ...) body ...)
Without an example, I can see how the equivalence mentioned at the top
may be misleading. Perhaps the manual should add an example? Even
something as simple as, say
(library (counters)
(export make-counter)
(import (rnrs base)
(define (make-counter start)
(lambda ()
(let ((val start))
(set! start (+ start 1))
val)))
)
would probably be helpful.
0. http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-10.html
1. http://www.gnu.org/software/guile/manual/html_node/R6RS-Libraries.html
--
Ian Price
"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"
next prev parent reply other threads:[~2011-12-07 23:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 17:53 bug#10246: R6RS library form broken? Tobias Brandt
2011-12-07 23:00 ` Ian Price [this message]
2011-12-08 20:05 ` Andy Wingo
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=877h28aswk.fsf@Kagami.home \
--to=ianprice90@googlemail.com \
--cc=10246@debbugs.gnu.org \
--cc=tob.brandt@googlemail.com \
/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).