[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10246: R6RS library form broken?

From: Ian Price
Subject: bug#10246: R6RS library form broken?
Date: Wed, 07 Dec 2011 23:00:59 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Tobias Brandt <address@hidden> 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

(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))


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"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]