GNU bug report logs - #38760
R7RS define-library form is not supported

Previous Next

Package: guile;

Reported by: Amirouche <amirouche <at> hyper.dev>

Date: Fri, 27 Dec 2019 08:45:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38760 in the body.
You can then email your comments to 38760 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#38760; Package guile. (Fri, 27 Dec 2019 08:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Amirouche <amirouche <at> hyper.dev>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Fri, 27 Dec 2019 08:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Amirouche <amirouche <at> hyper.dev>
To: bug-guile <at> gnu.org
Subject: R7RS define-library form is not supported
Date: Fri, 27 Dec 2019 08:44:36 +0000
Using guile-2.9.7.

Here is the tests files:

```scheme
$ cat main.scm
(import (scheme base))
(import (mylib))


(func)
$ cat mylib.scm
(define-library (mylib)

  (export func)

  (import (scheme base))
  (import (scheme write))

  (begin

    (define (func)
      (display 42)(newline))))
```

When i run `main.scm` with the `--r7rs` switch I get:

```
$ guile --r7rs -L . main.scm
guile: warning: failed to install locale
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /tmp/guile/r7rs/main.scm
;;; compiling ./mylib.scm
;;; WARNING: compilation of ./mylib.scm failed:
;;; Syntax error:
;;; mylib.scm:10:4: definition in expression context, where definitions 
are not allowed, in form (define (func) (display 42) (newline))
;;; WARNING: compilation of /tmp/guile/r7rs/main.scm failed:
;;; Syntax error:
;;; mylib.scm:10:4: definition in expression context, where definitions 
are not allowed, in form (define (func) (display 42) (newline))
;;; compiling ./mylib.scm
;;; WARNING: compilation of ./mylib.scm failed:
;;; Syntax error:
;;; mylib.scm:10:4: definition in expression context, where definitions 
are not allowed, in form (define (func) (display 42) (newline))
ice-9/psyntax.scm:2800:12: In procedure syntax-violation:
Syntax error:
mylib.scm:10:4: definition in expression context, where definitions are 
not allowed, in form (define (func) (display 42) (newline))
```

Removing the define-library's begin does not help.

Replacing define-library with library does lead to another error:

```scheme
$ guile --r7rs -L . main.scm
guile: warning: failed to install locale
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /tmp/guile/r7rs/main.scm
;;; compiling ./mylib.scm
;;; mylib.scm:6:2: warning: possibly unbound variable `import'
;;; mylib.scm:6:2: warning: possibly unbound variable `scheme'
;;; mylib.scm:6:2: warning: possibly unbound variable `write'
;;; <unknown-location>: warning: possibly unbound variable `display'
;;; compiled 
/home/amirouche/.cache/guile/ccache/3.0-LE-8-4.1/tmp/guile/r7rs/mylib.scm.go
;;; WARNING: compilation of /tmp/guile/r7rs/main.scm failed:
;;; Unbound variable: import
Backtrace:
           3 (primitive-load "/tmp/guile/r7rs/main.scm")
In ice-9/eval.scm:
   187:27  2 (_ _)
   223:20  1 (proc #<directory (guile-user) 7fcabe1def00>)
In unknown file:
           0 (%resolve-variable (7 . func) #<directory (guile-user) ?>)

ERROR: In procedure %resolve-variable:
Unbound variable: func
```

It says unbound `import` variable.  Add (import (only (guile) import)) 
on top make it work:

```scheme
$ cat mylib.scm
(library (mylib)

  (export func)

  (import (only (guile) import))
  (import (scheme base))
  (import (scheme write))

  (begin
    (define (func)
      (display 42)(newline))))
$ guile --r7rs -L . main.scm
guile: warning: failed to install locale
42
```




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Sun, 12 Jan 2020 19:34:01 GMT) Full text and rfc822 format available.

Notification sent to Amirouche <amirouche <at> hyper.dev>:
bug acknowledged by developer. (Sun, 12 Jan 2020 19:34:02 GMT) Full text and rfc822 format available.

Message #10 received at 38760-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Amirouche <amirouche <at> hyper.dev>
Cc: 38760-done <at> debbugs.gnu.org
Subject: Re: bug#38760: R7RS define-library form is not supported
Date: Sun, 12 Jan 2020 20:33:06 +0100
Thanks for the report; fixed!  Patches welcome if there are any bugs :)

Cheers,

Andy




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 10 Feb 2020 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 74 days ago.

Previous Next


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