unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* Errors using `reload' command
@ 2011-02-03 19:18 Mark Harig
  2011-02-08 22:48 ` Andy Wingo
  2011-02-08 22:58 ` Andy Wingo
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Harig @ 2011-02-03 19:18 UTC (permalink / raw)
  To: bug-guile

The Guile REPL's `reload' command does not always reload
modules successfully.  Below is a copy of a guile session
demonstrating some instances in which the `reload' command
fails, along with examples of the command completing
successfully.

[~]$ guile --no-autocompile
GNU Guile 1.9.15
Copyright (C) 1995-2010 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)> (version)
$1 = "1.9.15"

scheme@(guile-user)> %load-path
$2 = ("/usr/local/share/guile/2.0" "/usr/local/share/guile/site/2.0" 
"/usr/local/share/guile/site" "/usr/local/share/guile")

scheme@(guile-user)> ,h use
Usage: import [MODULE ...]
Import modules / List those imported.

scheme@(guile-user)> ,use
(guile)
(system base compile)
(ice-9 readline)
(ice-9 readline)
(ice-9 r5rs)
(ice-9 session)
(ice-9 regex)
(ice-9 threads)
(value-history)

[Note that "(ice-9 readline)" is listed twice, above.  This is not a 
transcription error.]

scheme@(guile-user)> ,h -c re
Usage: reload [MODULE]
Reload the given module, or the current module if none was given.

scheme@(guile-user)> ,re
While executing meta-command:
ERROR: unknown file name for module #<directory (guile-user) 257d090>

scheme@(guile-user)> ,re (system base compile)
scheme@(guile-user)> ,re (ice-9 r5rs)
scheme@(guile-user)> ,re (ice-9 session)
scheme@(guile-user)> ,re (ice-9 regex)
scheme@(guile-user)> ,re (ice-9 threads)
scheme@(guile-user)> ,re (ice-9 readline)
While executing meta-command:
ERROR: In procedure primitive-load-path:
ERROR: Unable to find file "guile-readline/ice-9/readline.scm" in load 
path

scheme@(guile-user)> ,re (value-history)
While executing meta-command:
ERROR: unknown file name for module #<directory (value-history) 2a1dab0>

scheme@(guile-user)> ,re (guile)
While executing meta-command:
ERROR: unknown file name for module #<module (guile) 257de10>

scheme@(guile-user)> ,q
[~]$



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Errors using `reload' command
  2011-02-03 19:18 Errors using `reload' command Mark Harig
@ 2011-02-08 22:48 ` Andy Wingo
  2011-02-08 22:58 ` Andy Wingo
  1 sibling, 0 replies; 7+ messages in thread
From: Andy Wingo @ 2011-02-08 22:48 UTC (permalink / raw)
  To: Mark Harig; +Cc: bug-guile

Hi Mark,

On Thu 03 Feb 2011 20:18, Mark Harig <idirectscm@aim.com> writes:

> scheme@(guile-user)> ,re
> While executing meta-command:
> ERROR: unknown file name for module #<directory (guile-user) 257d090>

Indeed, `reload' only works with modules that are associated with
files.  (guile-user) is not one of them.  Neither are these:

> (value-history)
> (guile)

But this is an interesting one:

> scheme@(guile-user)> ,use
> (system base compile)
> (ice-9 readline)
> (ice-9 readline)
> (ice-9 r5rs)
> (ice-9 session)
> (ice-9 regex)
> (ice-9 threads)
>
> [Note that "(ice-9 readline)" is listed twice, above.  This is not a
> transcription error.]

This appears to arise because use-modules clauses are evaluated twice
(once at expand-time, and once at load-time) and module-use-interfaces!
was not doing the right thing.  Fixed.

> scheme@(guile-user)> ,re (ice-9 readline)
> While executing meta-command:
> ERROR: In procedure primitive-load-path:
> ERROR: Unable to find file "guile-readline/ice-9/readline.scm" in load
> path

Fixed this one too, I think.

Thanks for the reports,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Errors using `reload' command
  2011-02-03 19:18 Errors using `reload' command Mark Harig
  2011-02-08 22:48 ` Andy Wingo
@ 2011-02-08 22:58 ` Andy Wingo
  2011-02-09  8:20   ` Andy Wingo
  1 sibling, 1 reply; 7+ messages in thread
From: Andy Wingo @ 2011-02-08 22:58 UTC (permalink / raw)
  To: Mark Harig; +Cc: bug-guile

On Thu 03 Feb 2011 20:18, Mark Harig <idirectscm@aim.com> writes:

> scheme@(guile-user)> ,re (ice-9 readline)

Actually now this causes an infinite loop.  Doh.  We need defvar,
somehow...

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Errors using `reload' command
  2011-02-08 22:58 ` Andy Wingo
@ 2011-02-09  8:20   ` Andy Wingo
  2011-02-09  9:51     ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Wingo @ 2011-02-09  8:20 UTC (permalink / raw)
  To: bug-guile

On Tue 08 Feb 2011 23:58, Andy Wingo <wingo@pobox.com> writes:

> On Thu 03 Feb 2011 20:18, Mark Harig <idirectscm@aim.com> writes:
>
>> scheme@(guile-user)> ,re (ice-9 readline)
>
> Actually now this causes an infinite loop.  Doh.  We need defvar,
> somehow...

What do people think about this:

    (define-syntax define-once
      (syntax-rules ()
        ((_ sym val)
         (define sym (if (defined? 'sym) sym val)))))

Should work, no?  I added this to boot-9 locally and used it in readline
and it appears to work fine.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Errors using `reload' command
  2011-02-09  8:20   ` Andy Wingo
@ 2011-02-09  9:51     ` Ludovic Courtès
  2011-02-09 19:59       ` Andy Wingo
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2011-02-09  9:51 UTC (permalink / raw)
  To: bug-guile

Hi!

Andy Wingo <wingo@pobox.com> writes:

> On Tue 08 Feb 2011 23:58, Andy Wingo <wingo@pobox.com> writes:
>
>> On Thu 03 Feb 2011 20:18, Mark Harig <idirectscm@aim.com> writes:
>>
>>> scheme@(guile-user)> ,re (ice-9 readline)
>>
>> Actually now this causes an infinite loop.  Doh.  We need defvar,
>> somehow...
>
> What do people think about this:
>
>     (define-syntax define-once
>       (syntax-rules ()
>         ((_ sym val)
>          (define sym (if (defined? 'sym) sym val)))))

Looks cool!

How about this variant?

    (define-syntax define-once
      (syntax-rules ()
        ((_ sym val)
         (define sym (if (defined? 'sym) sym val)))
        ((_ sym val docstring)
         (begin
           (define-once sym val)
           (set-doc-property! (module-variable (current-module) 'sym)
                              docstring)))))

Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Errors using `reload' command
  2011-02-09  9:51     ` Ludovic Courtès
@ 2011-02-09 19:59       ` Andy Wingo
  2011-02-09 20:49         ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Wingo @ 2011-02-09 19:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guile

On Wed 09 Feb 2011 10:51, ludo@gnu.org (Ludovic Courtès) writes:

> How about this variant?
>
>         ((_ sym val docstring)

No way to document variables in core, unfortunately.  But this isn't the
place to extend it anyway; (define sym val "docstring") should be
supported by default.

Cheers,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Errors using `reload' command
  2011-02-09 19:59       ` Andy Wingo
@ 2011-02-09 20:49         ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2011-02-09 20:49 UTC (permalink / raw)
  To: bug-guile

Andy Wingo <wingo@pobox.com> writes:

> On Wed 09 Feb 2011 10:51, ludo@gnu.org (Ludovic Courtès) writes:
>
>> How about this variant?
>>
>>         ((_ sym val docstring)
>
> No way to document variables in core, unfortunately.  But this isn't the
> place to extend it anyway; (define sym val "docstring") should be
> supported by default.

Right, good point.

Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-09 20:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-03 19:18 Errors using `reload' command Mark Harig
2011-02-08 22:48 ` Andy Wingo
2011-02-08 22:58 ` Andy Wingo
2011-02-09  8:20   ` Andy Wingo
2011-02-09  9:51     ` Ludovic Courtès
2011-02-09 19:59       ` Andy Wingo
2011-02-09 20:49         ` Ludovic Courtès

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).