From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: library vs define-module issue Date: Sat, 1 Aug 2020 14:01:41 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9985"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.8.0 To: Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Aug 01 14:02:33 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k1qDf-0002TE-4C for guile-user@m.gmane-mx.org; Sat, 01 Aug 2020 14:02:31 +0200 Original-Received: from localhost ([::1]:49018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k1qDd-0000o7-Qr for guile-user@m.gmane-mx.org; Sat, 01 Aug 2020 08:02:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1qD7-0000nP-N2 for guile-user@gnu.org; Sat, 01 Aug 2020 08:01:58 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:54034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1qCx-0004ZW-Ax for guile-user@gnu.org; Sat, 01 Aug 2020 08:01:57 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 8F1F3160061 for ; Sat, 1 Aug 2020 14:01:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1596283302; bh=+AmJ5ul/ZpjxfzKmDhmwMMY181oM2o3KjNRv8qmdQ0Y=; h=To:From:Subject:Date:From; b=aAV9klbxr2ajOPP9XRcMsJlbkSPdpsKzLmZB2rKEFXVyxK++4zyTF4B6aUYC1AAWb 1zZD+Dhmd8PfTE+wkjn5MZ65T/x8kO8PRW6KtYfqCmbHc8HPmRSWd/i+OkTicXBcK3 Wg9NgQtYg6s/CbC+FnFb2KnVCgtQboJvEdO+ZJoH7x2aZsJ4J7KzUjLaD+Ib0U98Aa CPhqG2cV0q2n+9XJeGFOK7K6WWDHJAJGQf9PCx/xQVwF7BMcbtISXZGxiycegdQUvQ GN3JNyujBVGCe83mbY5gOfOWKEQui4o4fk07xeVDnE2m6vfRcNad00iBLKfI61yTRX T0QCAwMLZvRgQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BJjRp0T60z9rxN for ; Sat, 1 Aug 2020 14:01:41 +0200 (CEST) Content-Language: en-US Received-SPF: pass client-ip=185.67.36.65; envelope-from=zelphirkaltstahl@posteo.de; helo=mout01.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/01 08:01:43 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16762 Archived-At: Hello Guile Users! I've hit an issue, when trying to make use of (library ...) [1] instead of (define-module ...) [2]. The file structure is as follows: ~~~~ . ├── example.scm ├── geometry-define-module.scm └── geometry.scm ~~~~ When I define my module as follows, in geometry-define-module.scm, it works: ~~~~ (define-module (geometry-define-module) #:export (point make-point get-point-label get-point-coords)) (use-modules (srfi srfi-9) (srfi srfi-9 gnu)) (define-immutable-record-type ;; define constructor (point label coords) ;; define predicate point? ;; define accessors and functional setters (label get-point-label set-point-label) (coords get-point-coords set-point-coords)) (define make-point (lambda* (coords #:key (label #f)) (cond [label (point label coords)] [else (point 'unlabeled coords)]))) ~~~~ I can import it in example.scm as follows (no errors): ~~~~ (use-modules (geometry-define-module)) ~~~~ But when I define my module using library as follows: ~~~~ (library (geometry (0 0 1)) (export point make-point get-point-label get-point-coords ) (import ;; structs (srfi srfi-9) (srfi srfi-9 gnu) ;; hash table #;(srfi srfi-69))) (define-immutable-record-type ;; define constructor (point label coords) ;; define predicate point? ;; define accessors and functional setters (label get-point-label set-point-label) (coords get-point-coords set-point-coords)) (define make-point (lambda* (coords #:key (label #f)) (cond [label (point label coords)] [else (point 'unlabeled coords)]))) ~~~~ I cannot import it, or rather there are errors: ~~~~ (import (geometry)) ~~~~ Calling Guile as follows: ~~~~ guile -L . --fresh-auto-compile example.scm ~~~~ The error is: ~~~~ ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/xiaolong/dev/Guile/algorithm-examples/basics/example.scm ;;; compiling ./geometry.scm ;;; geometry.scm:25:0: warning: possibly unbound variable `define' ;;; geometry.scm:26:2: warning: possibly unbound variable `lambda*' ;;; geometry.scm:26:11: warning: possibly unbound variable `coords' ;;; geometry.scm:26:25: warning: possibly unbound variable `label' ;;; geometry.scm:27:4: warning: possibly unbound variable `cond' ;;; geometry.scm:28:5: warning: possibly unbound variable `label' ;;; geometry.scm:29:6: warning: possibly unbound variable `label' ;;; geometry.scm:29:6: warning: possibly unbound variable `coords' ;;; geometry.scm:30:5: warning: possibly unbound variable `else' ;;; geometry.scm:31:13: warning: possibly unbound variable `quote' ;;; geometry.scm:31:13: warning: possibly unbound variable `unlabeled' ;;; geometry.scm:31:6: warning: possibly unbound variable `coords' ;;; compiled /home/xiaolong/.cache/guile/ccache/3.0-LE-8-4.3/home/xiaolong/dev/Guile/algorithm-examples/basics/geometry.scm.go ;;; WARNING: compilation of /home/xiaolong/dev/Guile/algorithm-examples/basics/example.scm failed: ;;; Unbound variable: define ~~~~ What am I doing wrong? Why is everything unbound, even core forms like define or cond? Perhaps I need to import some base thing when using (library …)? Best regards, Zelphir [1]: https://www.gnu.org/software/guile/manual/html_node/R6RS-Libraries.html [2]: https://www.gnu.org/software/guile/manual/html_node/Creating-Guile-Modules.html -- repositories: https://notabug.org/ZelphirKaltstahl