Hi Thien-Thi, On Wed 18 Nov 2009 06:16, Thien-Thi Nguyen <t...@gnuvola.org> writes:
> () Andy Wingo <wi...@pobox.com> > () Mon, 16 Nov 2009 20:23:07 +0100 > > However the use case is important. We need to implement a (current-file) > macro, I think, which should allow for file-relative loads. > > Is `current-load-port' still around for official Guile? Yes. > If so, > > (define (current-file) > (port-filename (current-load-port))) > > might be sufficient. It would probably have to be a macro, as the code that is actually loaded is bytecode -- the port has been closed already. This might work: (define-syntax current-file (lambda (x) (syntax-case x () ((_) (datum->syntax x (and=> (current-load-port) port-filename)))))) But we need the compiler to munge the current load port, which is currently does not. A bug. A -- http://wingolog.org/