From unknown Sun Jun 22 03:58:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#38760: R7RS define-library form is not supported Resent-From: Amirouche Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 27 Dec 2019 08:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38760 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 38760@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.157743628520629 (code B ref -1); Fri, 27 Dec 2019 08:45:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 Dec 2019 08:44:45 +0000 Received: from localhost ([127.0.0.1]:56485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iklEi-0005Me-Bp for submit@debbugs.gnu.org; Fri, 27 Dec 2019 03:44:45 -0500 Received: from lists.gnu.org ([209.51.188.17]:51604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iklEg-0005MX-BC for submit@debbugs.gnu.org; Fri, 27 Dec 2019 03:44:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52526) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iklEf-0000FN-2d for bug-guile@gnu.org; Fri, 27 Dec 2019 03:44:42 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iklEd-0005Jz-H6 for bug-guile@gnu.org; Fri, 27 Dec 2019 03:44:40 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:45687) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iklEd-0005Hn-Au for bug-guile@gnu.org; Fri, 27 Dec 2019 03:44:39 -0500 Received: from webmail.gandi.net (webmail23.sd4.0x35.net [10.200.201.23]) (Authenticated sender: amirouche@hyper.dev) by relay12.mail.gandi.net (Postfix) with ESMTPA id BF270200005 for ; Fri, 27 Dec 2019 08:44:36 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 27 Dec 2019 08:44:36 +0000 From: Amirouche Message-ID: <944e4d1a53eb901af8f06ce2d761e3bb@hyper.dev> X-Sender: amirouche@hyper.dev User-Agent: Roundcube Webmail/1.3.8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.178.232 X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) 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' ;;; : 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 #) In unknown file: 0 (%resolve-variable (7 . func) #) 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 ``` From unknown Sun Jun 22 03:58:07 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Amirouche Subject: bug#38760: closed (Re: bug#38760: R7RS define-library form is not supported) Message-ID: References: <87r204pj0t.fsf@pobox.com> <944e4d1a53eb901af8f06ce2d761e3bb@hyper.dev> X-Gnu-PR-Message: they-closed 38760 X-Gnu-PR-Package: guile Reply-To: 38760@debbugs.gnu.org Date: Sun, 12 Jan 2020 19:34:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1578857642-22031-1" This is a multi-part message in MIME format... ------------=_1578857642-22031-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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@debbugs.gnu.org. --=20 38760: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D38760 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1578857642-22031-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 38760-done) by debbugs.gnu.org; 12 Jan 2020 19:33:29 +0000 Received: from localhost ([127.0.0.1]:58007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqizI-0005iW-OL for submit@debbugs.gnu.org; Sun, 12 Jan 2020 14:33:28 -0500 Received: from fanzine.igalia.com ([178.60.130.6]:49721) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqizG-0005iF-6i for 38760-done@debbugs.gnu.org; Sun, 12 Jan 2020 14:33:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=pyFvhB2wOiy5iILWZ69XqJl01b6Yx2bPeRoI/tUrxgs=; b=dT11YZcsndlkq585NrJ4SZe46744deK06mrHBD60jQQxsYXxsn0b66wvBiUa+0Fxy3g8y23VWvkoKZKP7xKxr6O3KUbhroyrEr/MIUJbXwWEjP8V1Fxy1aYE8gkWCKIXjUvIeyeHcZo3OovvzrJYd4UN55WoUzljUrB+FPoGiHhtA+Abpl9tHJSoscvIt+fWsOL5ZE10VaMxZ7BwFV/TxUMmarZCs3ziwxyC9fB6NvnIalXoID6FTo5YZOS0ayDcF6I+KDPWDAdhdJTb9xE+MUiPALTSh1bW1AA41O1i1HDGDRgsVu6z97d+A9a/thzkZVsqkpouTNYNpnhIEBJMog==; Received: from [88.123.12.110] (helo=sparrow) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1iqiz7-0000Du-If; Sun, 12 Jan 2020 20:33:17 +0100 From: Andy Wingo To: Amirouche Subject: Re: bug#38760: R7RS define-library form is not supported References: <944e4d1a53eb901af8f06ce2d761e3bb@hyper.dev> Date: Sun, 12 Jan 2020 20:33:06 +0100 In-Reply-To: <944e4d1a53eb901af8f06ce2d761e3bb@hyper.dev> (amirouche@hyper.dev's message of "Fri, 27 Dec 2019 08:44:36 +0000") Message-ID: <87r204pj0t.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 38760-done Cc: 38760-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Thanks for the report; fixed! Patches welcome if there are any bugs :) Cheers, Andy ------------=_1578857642-22031-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Dec 2019 08:44:45 +0000 Received: from localhost ([127.0.0.1]:56485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iklEi-0005Me-Bp for submit@debbugs.gnu.org; Fri, 27 Dec 2019 03:44:45 -0500 Received: from lists.gnu.org ([209.51.188.17]:51604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iklEg-0005MX-BC for submit@debbugs.gnu.org; Fri, 27 Dec 2019 03:44:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52526) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iklEf-0000FN-2d for bug-guile@gnu.org; Fri, 27 Dec 2019 03:44:42 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iklEd-0005Jz-H6 for bug-guile@gnu.org; Fri, 27 Dec 2019 03:44:40 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:45687) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iklEd-0005Hn-Au for bug-guile@gnu.org; Fri, 27 Dec 2019 03:44:39 -0500 Received: from webmail.gandi.net (webmail23.sd4.0x35.net [10.200.201.23]) (Authenticated sender: amirouche@hyper.dev) by relay12.mail.gandi.net (Postfix) with ESMTPA id BF270200005 for ; Fri, 27 Dec 2019 08:44:36 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 27 Dec 2019 08:44:36 +0000 From: Amirouche To: bug-guile@gnu.org Subject: R7RS define-library form is not supported Message-ID: <944e4d1a53eb901af8f06ce2d761e3bb@hyper.dev> X-Sender: amirouche@hyper.dev User-Agent: Roundcube Webmail/1.3.8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.178.232 X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) 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' ;;; : 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 #) In unknown file: 0 (%resolve-variable (7 . func) #) 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 ``` ------------=_1578857642-22031-1--