[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile 1.9: bug in load
From: |
Ludovic Courtès |
Subject: |
Re: Guile 1.9: bug in load |
Date: |
Thu, 19 Nov 2009 01:29:46 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Hi Luca!
I actually looked into it on my trip back from Göteborg, in the hope of
fixing it for 1.9.5, in vain. I did reproduce the problem with
‘DIR/a.scm’ and ‘DIR/b/c.scm’ where ‘c.scm’ contains ‘(load "../a.scm")’.
I first tried to fix it by having ‘load’ prepend the directory name of
the file that is calling ‘load’ (hereafter the “loader”) to the path
passed to ‘load’ when it’s a relative path.
To do that, ‘load-compiled’ must be changed to honor
‘current-load-port’, so that we can get the path of the loader in there.
Unfortunately, that doesn’t work: autocompiled files live in a different
place than the corresponding .scm files, so at this point the original
file system context is lost. Perhaps a different mechanism could be
thought of to propagate the source file path associated with the current
load port.
Another solution would be to special-case calls to ‘load’ at
compile-time to replace its argument by an absolute path. However,
that’d be inelegant, especially since one could well ‘(set! load foo)’
at run-time.
Yet another solution would be to turn ‘load’ into an expansion-time
thing, but R5RS says it’s a procedure.
Thanks,
Ludo’.