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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Amirouche <amirouche <at> hyper.dev>
Subject: bug#38760: closed (Re: bug#38760: R7RS define-library form is not
 supported)
Date: Sun, 12 Jan 2020 19:34:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#38760: R7RS define-library form is not supported

which was filed against the guile package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 38760 <at> debbugs.gnu.org.

-- 
38760: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38760
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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

[Message part 3 (message/rfc822, inline)]
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
```



This bug report was last modified 5 years and 184 days ago.

Previous Next


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