From: Mark H Weaver <mhw@netris.org>
To: Nala Ginrut <nalaginrut@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: include can't work
Date: Sat, 16 Nov 2013 22:19:01 -0500 [thread overview]
Message-ID: <87txfb90m2.fsf@netris.org> (raw)
In-Reply-To: <1384501247.11916.8.camel@Renee-desktop.suse> (Nala Ginrut's message of "Fri, 15 Nov 2013 15:40:47 +0800")
Nala Ginrut <nalaginrut@gmail.com> writes:
> I encountered a bug while trying include some file:
> --------------------------cut------------------------
> scheme@(guile-user)> (include "aa.scm")
> While compiling expression:
> ERROR: In procedure string-length: Wrong type argument in position 1
> (expecting string): #f
> --------------------------end------------------------
The problem is that when the filename passed to 'include' is a relative
pathname, it interprets that pathname relative to the directory of the
file containing the 'include' form. In this case, the 'include' form is
not in a file at all, so that can't work.
Obviously the error message should be improved, but the upshot is this:
if you want to use 'include' from the REPL, or from some other port with
no associated filename, then you must pass it an absolute pathname.
In this case, I suppose the intuitive expectation is that the filename
should be interpreted relative to the current working directory of the
Guile process, but that is totally different than how 'include' is
expected to work in the usual case. Personally, I think it would be a
mistake to muddy the semantics of 'include' to support these two very
different uses.
When you're at the REPL, why not just use 'load' instead?
Thoughts?
Mark
next prev parent reply other threads:[~2013-11-17 3:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 7:40 include can't work Nala Ginrut
2013-11-17 3:19 ` Mark H Weaver [this message]
2013-11-17 4:33 ` Mark H Weaver
2013-11-17 21:09 ` Ludovic Courtès
2013-11-18 6:14 ` Mark H Weaver
2013-11-17 8:24 ` Nala Ginrut
2013-11-17 10:09 ` Mark H Weaver
2013-11-18 7:55 ` Nala Ginrut
2013-11-18 18:13 ` Mark H Weaver
2013-11-18 18:15 ` Mark H Weaver
2013-11-19 3:06 ` Nala Ginrut
[not found] <mailman.171.1384534862.25052.guile-devel@gnu.org>
2013-11-15 17:12 ` Daniel Llorens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87txfb90m2.fsf@netris.org \
--to=mhw@netris.org \
--cc=guile-devel@gnu.org \
--cc=nalaginrut@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).