guile-user
[Top][All Lists]
Advanced

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

Re: How to correctly load modules from runtime defineable locations?


From: Ludovic Courtès
Subject: Re: How to correctly load modules from runtime defineable locations?
Date: Sun, 08 Mar 2020 12:59:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello,

Михаил Бахтерев <address@hidden> skribis:

> (let* ((fn (current-filename))                                               
>        (dir (if (string? fn) (dirname fn) "."))                              
>        (lib (if (string? fn) (string-append (dirname dir) "/lib") "../lib")))
>   (add-to-load-path lib)                
>   (add-to-load-path dir))

I think the crux is that you’d like this code to run both at
macro-expansion time and at run time.  To do that, you need to enclose
it in ‘eval-when’ (info "(guile) Eval When"):

  (eval-when (expand load eval)
    (let …
      (add-to-load-path …)
      …))

(Note that ‘add-to-load-path’ actually does this, but only if the
argument is a literal string.)

HTH!

Ludo’.




reply via email to

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