guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading a module before and after adding a load path


From: Diogo F. S. Ramos
Subject: Re: Loading a module before and after adding a load path
Date: Sat, 19 Jan 2013 02:15:36 -0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Nala Ginrut <address@hidden> 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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]