unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Sam Lee via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" <bug-guile@gnu.org>
To: 52218@debbugs.gnu.org
Subject: bug#52218: Unable to define more than one R7RS library per file
Date: Wed, 1 Dec 2021 07:45:53 +0000	[thread overview]
Message-ID: <20211201074553.bzuoffwpaxw3da44@localhost> (raw)
In-Reply-To: 20211201074553.bzuoffwpaxw3da44.ref@localhost

Guile is unable to handle more than one define-library per file. For
example, this is "mylibs.sld", which contains two define-library:

(define-library (example mylib)
  (import (scheme base))
  (export f)
  (begin
    (define (f x)
      (+ x 1))))

(define-library (example main)
  (import (scheme base)
          (scheme write)
          (example mylib))
  (export main)
  (begin
    (define (main)
      (display "The answer is: ")
      (display (f 1))
      (newline))))


When loading this file into Guile using "guile -l mylibs.sld", or by
using (load "mylibs.sld"), Guile will show this error:

;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/user/mylibs.sld
;;; WARNING: compilation of /home/user/mylibs.sld failed:
;;; Syntax error:
;;; unknown location: definition in expression context, where definitions are not allowed, in form (define (main) (display "The answer is: ") (display (f 1)) (newline))
ice-9/psyntax.scm:2794:12: In procedure syntax-violation:
Syntax error:
/home/user/mylibs.sld:14:4: definition in expression context, where definitions are not allowed, in form (define (main) (display "The answer is: ") (display (f 1)) (newline))


The error is always caused by the second define-library. Apparently,
Guile no longer understands that define-library is a special form by the
time the second define-library is evaluated. Is it not possible to
define two R7RS libraries in the same file?

Guile version: 3.0.7





       reply	other threads:[~2021-12-01  7:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211201074553.bzuoffwpaxw3da44.ref@localhost>
2021-12-01  7:45 ` Sam Lee via Bug reports for GUILE, GNU's Ubiquitous Extension Language [this message]
2021-12-01 10:00   ` bug#52218: Unable to define more than one R7RS library per file Linus Björnstam
2021-12-02  2:55     ` Sam Lee via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2021-12-03 14:20       ` Linus Björnstam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211201074553.bzuoffwpaxw3da44@localhost \
    --to=bug-guile@gnu.org \
    --cc=52218@debbugs.gnu.org \
    --cc=samlee746@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).