* bug#18127: add-to-load-path adds a path twice
@ 2014-07-28 13:06 Alex Kost
2014-07-30 18:36 ` Ian Price
0 siblings, 1 reply; 2+ messages in thread
From: Alex Kost @ 2014-07-28 13:06 UTC (permalink / raw)
To: 18127
Hello, I noticed that ‘add-to-load-path’ adds a path 2 times when it is
called in Guile REPL.
taylanub from #guile explained that it may happen because in the REPL
the compilation and execution happen in the same session and
“‘add-to-load-path’ takes care of modifying the path both at
compile-time and at run-time.” (from manual).
Here is the session for illustrating the bug (if it's a bug) :
$ guile
GNU Guile 2.0.11
Copyright (C) 1995-2014 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)> %load-path
$1 = ( "/usr/share/guile/2.0" "/usr/share/guile/site/2.0" "/usr/share/guile/site" "/usr/share/guile")
scheme@(guile-user)> (add-to-load-path "foo")
scheme@(guile-user)> %load-path
$2 = ("foo" "foo" "/usr/share/guile/2.0" "/usr/share/guile/site/2.0" "/usr/share/guile/site" "/usr/share/guile")
scheme@(guile-user)> ,q
Also I have a question: Why there is no ‘add-to-load-compiled-path’? I
think such function may also be useful.
Thanks,
Alex
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#18127: add-to-load-path adds a path twice
2014-07-28 13:06 bug#18127: add-to-load-path adds a path twice Alex Kost
@ 2014-07-30 18:36 ` Ian Price
0 siblings, 0 replies; 2+ messages in thread
From: Ian Price @ 2014-07-30 18:36 UTC (permalink / raw)
To: Alex Kost; +Cc: 18127, 18127-done
Alex Kost <alezost@gmail.com> writes:
> taylanub from #guile explained that it may happen because in the REPL
> the compilation and execution happen in the same session and
> “‘add-to-load-path’ takes care of modifying the path both at
> compile-time and at run-time.” (from manual).
This is correct, it will also happen in scripts if they are
auto-compiled, but you will only see it once on subsequent runs, since
macro-expansion doesn't need to happen again.
The fix is simple, and there is no harm in it, so I've pushed a fix to
stable-2.0.
> Also I have a question: Why there is no ‘add-to-load-compiled-path’? I
> think such function may also be useful.
Fair question. I have no idea about the answer, but I've not touched
this one. As a general principle, I wouldn't like to see us have a
separate macro for each of these.
Thanks
--
Ian Price -- shift-reset.com
"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-30 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28 13:06 bug#18127: add-to-load-path adds a path twice Alex Kost
2014-07-30 18:36 ` Ian Price
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).