This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hello, >>>>> "Michael" == Michael N Livshin <mikel@opal.co.il> writes: Michael> The feature is that Guile temporarily sets the cwd during Michael> `load' to the directory where the file being loaded sits. Michael> This is good for files that load (with `load') other Michael> files. I'm really beginning to think the current behavior is a "bad thing". For one thing, it interacts poorly with the module system. For another, it seems to violate the "principle of least surprise" when the application invisibly changes the cwd. For instance if I have: base/ test1.scm (display "my test1\n") base/dir/ test.scm (display "test\n") (display "cwd is ") (display (getcwd)) (newline) (load "test1.scm") test1.scm (display "dir/test1\n") then: base> pwd base base> guile guile> (load "test1.scm") my test1 guile> (load "dir/test.scm") test cwd is base dir/test1 <<< My naive expectation is "my test1" guile> (display (getcwd)) base I expected that adding: (!append %load-path (list (getcwd) ".")) to my .guile would be a reasonable solution, but it doesn't change the behaviour. In fact if I (set! %load-path '()), it still doesn't get "my test1". I can see how this happens, but I think it's wrong. I'm muddling through the consequences, but it seems like load should precisely follow %load-path and if %load-path is '() then load can only find files starting from root (eg "/usr/..."). I think there is a reasonable argument that the cwd should not be in the default load path, but if it is then "." should refer to the directory that a file is loaded from and the result of (getcwd) should be before "." in %load-path. Cheers, Clark