[racket] Splitting Racket source code by scope?

From: Rüdiger Asche (rac at ruediger-asche.de)
Date: Mon Feb 27 17:33:16 EST 2012

Thanks again - but there is something in path resolution policy I don't 
understand - why does this one here:

(parameterize ([current-directory "f:"])
(load "suchandsuch.scs"))

give the expected result (reads the file from f:), but this one here:

(parameterize ([current-directory "f:"])
(include "othersuch.scs"))

doesn't (raises error stdin::196512: include: can't open include file 
(open-input-file: cannot open input file: "D:\install\racket\othersuch.scs" 
(Das System kann die angegebene Datei nicht finden.; errno=2)) at: 
#<path:D:\install\racket\othersuch.scs> in: (include "othersuch.scs")) ? I 
read the docs to use current-directory consistently on load and include?

----- Original Message ----- 
From: "Danny Yoo" <dyoo at cs.wpi.edu>
To: "Rüdiger Asche" <rac at ruediger-asche.de>
Cc: <users at racket-lang.org>
Sent: Monday, February 27, 2012 6:22 PM
Subject: Re: [racket] Splitting Racket source code by scope?


On Mon, Feb 27, 2012 at 11:38 AM, Rüdiger Asche <rac at ruediger-asche.de> 
wrote:
> I'd like to split the components of my Racket project into multiple files
> according to this structure:
>
> contents of file1:
>
> (letrec ((id1 body1)
> ...
> <contents of file2, see below>
> ...
> )
> (main execution body using id1, idx, idy...)
> )


As Matthias mentions, you can formally link together "units" together.
 Units are Racket's dependency-injection component framework.  You can
read documentation about them here:

    http://docs.racket-lang.org/guide/units.html


Although there are other mechanisms for textually substituting the
content of one file within another, such as the racket/include
library:

    http://docs.racket-lang.org/reference/include.html

because you mentioned components in your question, the racket/unit
framework might be more suitable for your purposes.


Posted on the users mailing list.