[Top][All Lists]

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

Re: Modules

From: Neil Jerram
Subject: Re: Modules
Date: Sat, 29 Jan 2011 13:18:16 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Neil Jerram <address@hidden> writes:

> Marek Kubica <address@hidden> writes:
>> What about "the same directory that the file is in"? The point is, when
>> writing scripts that become larger than one file, splitting them into
>> modules becomes immensely painful because the modules cannot find each
>> other.
> I agree that this is a bit awkward.  My current solution is
> (load "setup-load-path.scm")
> at the start of each top-level script - which relies on the fact that
> `load' will look in the same directory as the script file - with
> setup-load-path.scm containing:
> (cond-expand (guile-2
>             (eval-when (load compile)

It's amazing how writing an email sets you thinking about whether
something is really correct...

In fact I think the top level probably needs to be

(cond-expand (guile-2 (include "setup-load-path.scm"))
             (else (load "setup-load-path.scm")))

so that the path is set up for 1.9/2.0 compilation time.  I wonder if it
works to write that as

((cond-expand (guile-2 include) (else load)) "setup-load-path.scm")

And then setup-load-path.scm can be just

      (let* ((bindir (dirname (car (command-line))))
             (absdir (cond ((string=? bindir ".")
                           ((string-match "^/" bindir)
                            (in-vicinity (getcwd) bindir)))))
        (set! %load-path (cons (in-vicinity absdir "..")

Which isn't so bad.

reply via email to

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