From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id AA779386F009 for ; Fri, 5 Feb 2021 14:22:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AA779386F009 Received: by mail-ej1-x632.google.com with SMTP id bl23so12191095ejb.5 for ; Fri, 05 Feb 2021 06:22:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=d6eAIOsQVhIvZbIrKIuTCZYyZZcoGX0OWMhb5Aas5XI=; b=ZvVrY98xtw2auDJWzUrml9LNkgIdl0ouXRPXHtHVnGDRYos+G68yMXzzbKUscMl9T6 4s9hnhSe7NuZto31LvN2xRzj5IR85gd2PBHqKC9/4vqJhXFqdveLHI1RXczdmUsAlJvZ t0CgPwAmN529BZWehQMNjdBZrgGq2aq8mK5tqfvzsL315X5GkYJatmmzMoQW76Dz+3a9 5I1ZXTOS9oPWW/0TmF9ZzqpW/73Lmkoe1IHR2prnGMlrBrrtIl5nDWfcOanAfxTe8qVM tH4TQZha72j3XHkj4WbTKhSfXL9zXQSZLorhAnQedl58VARv5y2JQlRAS3w4sOg7steY B2VA== X-Gm-Message-State: AOAM530z7ViTqhoaiqnRS5Tr0LOGU5aLhjLItF39vAU8+sxc0DqURDqG xzacDvNtqazw3ARWUycVzfi6gzvZI0LwW0DxFMrvY8ziijrLiw== X-Google-Smtp-Source: ABdhPJwu04M9zlVik99k0tDUaD8E4TUFHHGcg8Ccjy5BVh1jQhNdjEAsx8s/OcOGCO2Vm4j9bPdLgOuJBlZ1e8tVYhg= X-Received: by 2002:a17:906:7698:: with SMTP id o24mr4128218ejm.504.1612534927408; Fri, 05 Feb 2021 06:22:07 -0800 (PST) MIME-Version: 1.0 From: "J. Vincent Toups" Date: Fri, 5 Feb 2021 09:21:56 -0500 Message-ID: Subject: Behavior of (import ...) in R7RS define-library forms To: kawa@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 14:22:10 -0000 I have two r7rs-style libraries, one of which depends on the other, located in the following filesystem structure: src/lib/shadchen-helpers.scm src/lib/shadchen.scm In principle, shadchen-helpers isn't useful on its own - it provides some helper material for the shadchen library. The library definitions look like this: $ find src/ -iname "*.scm" | grep lib | xargs head -n 2 ==> src/lib/shadchen-helpers.scm <== (define-library (lib shadchen-helpers) ==> src/lib/shadchen.scm <== (define-library (lib shadchen) So if I start a repl like this: $ java -jar lib/kawa.jar -Dkawa.import.path="./src/*.scm" Kawa can find the libraries if I do an import: #|kawa:1|# (import (lib shadchen-helpers)) The above works fine. However, in a fresh interpreter: #|kawa:1|# (import (lib shadchen)) /home/toups/work/games/jmonkey3d-lacraw/src/lib/shadchen.scm:9:4: unknown library (lib shadchen-helpers) /home/toups/work/games/jmonkey3d-lacraw/src/lib/shadchen.scm:110:6: warning - no declaration seen for pattern-bindings-equal? /home/toups/work/games/jmonkey3d-lacraw/src/lib/shadchen.scm:117:6: warning - no declaration seen for all-identifiers? The import fails because the library reference to shadchen-helpers fails to resolve. That reference in `shadchen.scm` looks like this: (import (except (kawa base) match) (kawa lib std_syntax) (srfi 28) (rnrs sorting (6)) (rnrs hashtables (6)) (lib shadchen-helpers)) I have noticed that importing shadchen-helpers at the repl first and then importing shadchen works. I would guess because importing the shadchen-helpers library compiles that library and then the import form in the r7rs define-library can then find the compiled artifact. But doesn't it make sense for the import form in shadchen to trigger the compilation of shadchen-helpers so that it behaves the same as a top-level import? Is there any way I can get this behavior? It seems limiting to interactive development to have to have either a build process or a script to import all libraries despite an explicit dependency graph existing in the form of the import statements in the library definitions? I'm relatively new to Kawa and a little rusty in Java (long time Schemer, though) so maybe I'm missing something. -V