From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: diogofsr@gmail.com (Diogo F. S. Ramos) Newsgroups: gmane.lisp.guile.user Subject: Re: Loading a module before and after adding a load path Date: Sat, 19 Jan 2013 02:15:36 -0200 Message-ID: <87ip6tx0yf.fsf@supernova.vialactea> References: <87bocmxzax.fsf@supernova.vialactea> <1358565467.2720.35.camel@Renee-desktop.suse> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1358568981 15861 80.91.229.3 (19 Jan 2013 04:16:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Jan 2013 04:16:21 +0000 (UTC) Cc: guile-user@gnu.org To: Nala Ginrut Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Jan 19 05:16:39 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TwPr3-0002HD-EC for guile-user@m.gmane.org; Sat, 19 Jan 2013 05:16:29 +0100 Original-Received: from localhost ([::1]:53303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwPqm-0003Jh-Dw for guile-user@m.gmane.org; Fri, 18 Jan 2013 23:16:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwPqh-0003JZ-Ee for guile-user@gnu.org; Fri, 18 Jan 2013 23:16:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwPqK-00005h-Tk for guile-user@gnu.org; Fri, 18 Jan 2013 23:16:07 -0500 Original-Received: from mail-yh0-f43.google.com ([209.85.213.43]:36179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwPqK-00005H-Oq for guile-user@gnu.org; Fri, 18 Jan 2013 23:15:44 -0500 Original-Received: by mail-yh0-f43.google.com with SMTP id z20so118969yhz.2 for ; Fri, 18 Jan 2013 20:15:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=H10Q8v09JUcSfKDw33z+SI9lnnxWBhz8BWlf1tZ6snA=; b=CNceYjapgbJLvO0NGLwW0aCGYNzPnsJd9noN67L2ywU/tRwDyDElCOgEpR/a48jMeg Mz4EypGLKB454RwzGziHLvB7Yy7CSo7EQqzE9EbOeK/zKF4Xd9HuxWcuPejpCt5EXNC6 dVDj6Tf2E2ElIj0wdX/vRQ7HEn5xKoHxRYIKwErBobU6w0/u7gQO2OSpzcQRHNHVM+cM HOWpYzq737MQBY7YtwI3ireJU4qGBM5IUSqiV57Wjn63PZtsy3bh4JS530xP7DDoiGls Zu3nP6mOmC8nP7zxcl6Dw989Y5al/hrBMQshkMmq7Jbc5EUevppeftGw7aUvMrjKyegX S9ag== X-Received: by 10.236.151.76 with SMTP id a52mr12862930yhk.107.1358568943983; Fri, 18 Jan 2013 20:15:43 -0800 (PST) Original-Received: from supernova.vialactea ([187.122.90.148]) by mx.google.com with ESMTPS id j8sm5955370ank.21.2013.01.18.20.15.41 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 18 Jan 2013 20:15:43 -0800 (PST) Original-Received: from didi by supernova.vialactea with local (Exim 4.76) (envelope-from ) id 1TwPqC-0000NJ-Fe; Sat, 19 Jan 2013 02:15:36 -0200 In-Reply-To: <1358565467.2720.35.camel@Renee-desktop.suse> (Nala Ginrut's message of "Sat, 19 Jan 2013 11:17:47 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.213.43 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9886 Archived-At: Nala Ginrut 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) ;;; :4:0: warning: possibly unbound variable `hello' :4:0: In procedure #:4:0 ()>: :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?