bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile 1.9: bug in load


From: Andy Wingo
Subject: Re: Guile 1.9: bug in load
Date: Wed, 18 Nov 2009 22:03:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi Thien-Thi,

On Wed 18 Nov 2009 06:16, Thien-Thi Nguyen <address@hidden> writes:

> () Andy Wingo <address@hidden>
> () 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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]