From: diogofsr@gmail.com (Diogo F. S. Ramos)
To: Nala Ginrut <nalaginrut@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: Loading a module before and after adding a load path
Date: Sat, 19 Jan 2013 02:15:36 -0200 [thread overview]
Message-ID: <87ip6tx0yf.fsf@supernova.vialactea> (raw)
In-Reply-To: <1358565467.2720.35.camel@Renee-desktop.suse> (Nala Ginrut's message of "Sat, 19 Jan 2013 11:17:47 +0800")
Nala Ginrut <nalaginrut@gmail.com> writes:
> Why you need to load the module without giving its path?
Sorry, I should have added some more context.
While I'm working with the REPL, sometimes I forget to add the path to a
module before trying to use it. It's a mistake. So, after trying to load
the module with `use-modules', and failing, I remember that I have to
add the path to the module. So I add the path to the module with
`add-to-load-path' and I try again to evaluate
`use-modules'. Unfortunately it does not load it and I'm stuck. To fix
it, I end up restarting the REPL and adding the path _before_ trying to
load it, as it's the right way to do it.
Here is an example with my typical mistake:
$ cat /tmp/foo/bar.scm
(define-module (foo bar))
(define-public (hello)
(display "hello, world")
(newline))
$ guile
GNU Guile 2.0.5-deb+1-1
Copyright (C) 1995-2012 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (use-modules (foo bar))
While compiling expression:
ERROR: no code for module (foo bar)
scheme@(guile-user)> (add-to-load-path "/tmp")
scheme@(guile-user)> (use-modules (foo bar))
While compiling expression:
ERROR: no code for module (foo bar)
scheme@(guile-user)> (hello)
;;; <stdin>:4:0: warning: possibly unbound variable `hello'
<unnamed port>:4:0: In procedure #<procedure e3f580 at <current input>:4:0 ()>:
<unnamed port>:4:0: In procedure module-lookup: Unbound variable: hello
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
The question is: Is there a way to recover from this mistake in my live
REPL session?
next prev parent reply other threads:[~2013-01-19 4:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 15:53 Loading a module before and after adding a load path Diogo F. S. Ramos
2013-01-18 17:44 ` Yanbin Zhang
2013-01-18 18:17 ` Diogo F. S. Ramos
2013-01-19 3:17 ` Nala Ginrut
2013-01-19 4:15 ` Diogo F. S. Ramos [this message]
2013-01-19 4:32 ` Noah Lavine
2013-01-19 6:05 ` Diogo F. S. Ramos
2013-01-20 18:34 ` Andy Wingo
2013-01-21 17:20 ` Ludovic Courtès
2013-01-21 18:12 ` Andy Wingo
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=87ip6tx0yf.fsf@supernova.vialactea \
--to=diogofsr@gmail.com \
--cc=guile-user@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).