emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#38760: closed (R7RS define-library form is not supported)


From: GNU bug Tracking System
Subject: bug#38760: closed (R7RS define-library form is not supported)
Date: Sun, 12 Jan 2020 19:34:01 +0000

Your message dated Sun, 12 Jan 2020 20:33:06 +0100
with message-id <address@hidden>
and subject line Re: bug#38760: R7RS define-library form is not supported
has caused the debbugs.gnu.org bug report #38760,
regarding R7RS define-library form is not supported
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
38760: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38760
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: R7RS define-library form is not supported Date: Fri, 27 Dec 2019 08:44:36 +0000 User-agent: Roundcube Webmail/1.3.8
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
```



--- End Message ---
--- Begin Message --- Subject: Re: bug#38760: R7RS define-library form is not supported Date: Sun, 12 Jan 2020 20:33:06 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Thanks for the report; fixed!  Patches welcome if there are any bugs :)

Cheers,

Andy


--- End Message ---

reply via email to

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