[plt-scheme] require with custom modules

From: Cyprien Nicolas (c.nicolas at gmail.com)
Date: Sat Nov 10 13:34:24 EST 2007

Hi

I'm building an application to compile a subset of BASIC expressions
into scheme (my Interpretation course at the University of Nice), I
have defined several modules to handle the compilation process (lexer,
parser, etc).

The application is launched by a main.scm file located in the root
directory of the app.
The GUI is located in a gui/ dir, and the modules in the parse/ dir

So I use (load (build-path (current-directory) "gui" "gui.scm") to
load the GUI, and I'd like to do the same for require my modules,
because gui.scm needs to load some of them.

I don't want to use the form (require (file "../parse/parser.ss"))
because I hate using .. in file paths, and depending on where the
require is made, every path will be different.
So I think using (build-path ) could be a cleaner way, after defining
every dir in the main.scm
For example, the path to the lexer will be (build-path
myapp-modules-directory "lexer.ss").

However, the require special form doesn't evaluate its arguments,
neither (require (build-path some-dir some-file)) nor (require (file
(build-path some-dir some-file))) works.

I look at require in the PLT Help Desk and I didn't find a way to do this.
I also looked for a way to add my app/parse path to the require
default path, but the only thing I found is to use
(current-library-collection-paths) is order to cons a new path into
this list and to use (require (lib ...)), and then to add a collects
dir into my project.

I don't think that is the good way to resolve my problem because my
modules are specific to the application and there are *not really*
library files.

So, Is using current-library-collection-paths the good way to do this ?
Or maybe I make a misuse of modules...

Thanks
-- 
Cyprien Nicolas


Posted on the users mailing list.