[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#49452: Confusing behavior with (include) used in file in GUILE_LOAD_
bug#49452: Confusing behavior with (include) used in file in GUILE_LOAD_PATH
Wed, 7 Jul 2021 23:22:56 +0200
On +2021-07-06 19:31:38 -0500, Vijay Marupudi wrote:
> Hello all,
> It is unclear to me what the intended behavior for (include
> "filename.scm") is, so I'm sending an email about this potential bug.
> The Local Inclusion docs
> seem to state that relative paths are found relative to the file that
> included them.
> > If file-name is a relative path, it is searched for relative to the
> > path that contains the file that the include form appears in.
> So if I have a file "/libraries/libname/main.scm" than has (include
> "./helpers.scm"), then the file "/libraries/libname/helpers.scm"
> *should* (I think) be imported.
A little nit, but
is not identical to
so might it be worth trying
in your code?
And/or should the docs explain that both ways of writing a relative
file name in this context are or are not acceptable?
Might some macro dislike leading dots?
Long shot ;-)
> But this does not seem to work if "/libraries" is in the GUILE_LOAD_PATH
> and my current working directory is somewhere else, say "/home/user" and
> I'm running "/home/user/program.scm" that imports the (libname main)
> library from "/libraries". Then Guile seems to try to include the
> "libname/helpers.scm" file from the current directory, which does not
> Conversations with leoprikler in IRC have revealed to me that
> call-with-include-port is the function responsible for this behavior
> `syntax-source` returns a file path relative to the load path, and
> include tries to use that path to open a file relative to the current
> working directory.
> In Guile's bug guidelines
> to me this fits
> * Whenever documentation and actual behavior differ, you have certainly
> found a bug, either in the documentation or in the program.
> and potentially
> * When some part of the documentation is not clear and does not make
> sense to you even after re-reading the section, it is a bug.
> I believe this is a bug, but I may be wrong, so emailing to clarify.
> Thank you!
> Vijay Marupudi
> PhD Student in Human Centered-Computing
> Georgia Institute of Technology