[plt-scheme] require with custom modules

From: Cyprien Nicolas (c.nicolas at gmail.com)
Date: Sun Nov 11 17:43:51 EST 2007

2007/11/10, Ryan Culpepper <ryanc at ccs.neu.edu>:
> Just wondering, why does "main.scm" use 'load' instead of 'require'?

Hi Ryan

I use load here, because the interface is not a module file, it only
contains the code for defining the GUI. I can also use include instead
of load.
load evaluate the source file, before including the definitions,
whereas include copies the source code into the current file, and
evaluate all the file after, so with include, all paths starts from
the current-directory.

> Based on your description of the organization of your modules, ".." is
> the right solution. You don't need the 'file' part, though:
>
>   (require "../parse/parser.ss")
>
> Then, if you move your project directory to a new place, the relative
> module path still works. If you send your code to a friend, it still
> works. If you turn it into a PLaneT package, it still works. If you
> reorganize your project directories, you'll have to update them, but
> that shouldn't happen often, and it's easy to update anyway.
>
> Do you have a particular reason for disliking ".." in module paths? It
> really is standard for internal references within a body of code.

I have, suppose that I add new modules to my project, but some of them
are not related with parsing, so I create a new dir modules, and move
the parse dir into modules.
Using build-path and the a-list I described in my response above, I
only have to edit a line from my main file, instead of rewritting
every paths in every file using modules defined in the parse
directory. It's just for convenience.

> Don't use 'current-library-collection-paths'. It isn't the right
> solution.

Ok, I agree with you on that point.


Thanks for your comments

-- 
Cyprien Nicolas


Posted on the users mailing list.