public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Effect of include-library-declarations on "current root" for import
@ 2017-03-01 21:52 Sudarshan S Chawathe
  2017-03-01 22:47 ` Per Bothner
  0 siblings, 1 reply; 3+ messages in thread
From: Sudarshan S Chawathe @ 2017-03-01 21:52 UTC (permalink / raw)
  To: kawa

This question is about "current root" as used in the "searching for
source files" section of the manual (within "importing from a library").

The main question is: Is the "current root" for library imports spliced
in using include-library-declarations (potentially) different from the
"current root" of the file containing the include-library-declarations?

My understanding of the description in the manual, and the recent thread
on this mailing list ("import path vs CLASSPATH") is that when a library
definition in a file alpha.sld uses

  (include-library-declarations "../foo/bar/common.scm")

to splice in some forms, the current root for any imports in common.scm
is the same as the current root for alpha.sld, regardless of the
location of common.scm.

However, that does not appear to be true, based on the small example
included below.  (If I move common.scm to the "ab" directory and change
"../common.scm" to "common.scm" then there are no errors.)

I am not sure if this is intended/desirable behavior.

Regards,

-chaw


Example...

$ cat test-ab.scm
(import (scheme base)
        (scheme write)
        (alpha))
(write "test-ab")
(write alpha)
(newline)

$ cat alpha.sld
(define-library (alpha)
  (export alpha)
  (import (scheme base)
          (scheme write))
  (include-library-declarations "../common.scm")
  (begin
    (write "alpha, bravo: ")
    (write bravo)
    (newline)
    (define alpha bravo)))

$ cat ../common.scm
(import (bravo))

$ cat bravo.sld
(define-library (bravo)
  (export bravo)
  (import (scheme base)
          (scheme write))
  (begin
    (write "bravo")
    (newline)
    (define bravo 6)))

$ kawa -Dkawa.import.path="./*.sld" test-ab.scm
/home/chaw/res/scheme/kawa/misc/ab/../common.scm:1:9: unknown library (bravo)
/home/chaw/res/scheme/kawa/misc/ab/alpha.sld:8:12: warning - no declaration seen for bravo
/home/chaw/res/scheme/kawa/misc/ab/alpha.sld:10:19: warning - no declaration seen for bravo

$ kawa --version
Kawa 2.3.1 (git describe: kawa-2.3-4-gcb36c64-dirty)
Copyright (C) 2017 Per Bothner

$ uname -a
Linux vereq.eip10.org 3.16.0-4-686-pae #1 SMP Debian 3.16.39-1+deb8u1 (2017-02-22) i686 GNU/Linux
$ 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-01 23:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 21:52 Effect of include-library-declarations on "current root" for import Sudarshan S Chawathe
2017-03-01 22:47 ` Per Bothner
2017-03-01 23:05   ` Sudarshan S Chawathe

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).