GNU bug report logs - #10246
R6RS library form broken?

Previous Next

Package: guile;

Reported by: Tobias Brandt <tob.brandt <at> googlemail.com>

Date: Wed, 7 Dec 2011 18:08:01 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ian Price <ianprice90 <at> googlemail.com>
To: Tobias Brandt <tob.brandt <at> googlemail.com>
Cc: 10246 <at> debbugs.gnu.org
Subject: bug#10246: R6RS library form broken?
Date: Wed, 07 Dec 2011 23:00:59 +0000
Tobias Brandt <tob.brandt <at> 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"




This bug report was last modified 13 years and 224 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.