[racket] Splitting Racket source code by scope?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed Feb 29 19:12:54 EST 2012

On Wed, Feb 29, 2012 at 6:38 PM, Rüdiger Asche <rac at ruediger-asche.de> wrote:
> ok, so the difference is between doing things in the upper respective lower
> window - thanks for the instructions; if I follow them with my code
> fragments, it works as well. Trying to do everything interactively (lower
> pane) yields the errors I described (btw it's the same behavior as when I
> run in racket instead of DrRacket).


Ah, I see now.  Then the problem you were running into has very little
to do with units: it's more with how Racket's REPL works with Racket's
module system.


Usually, you have one module per file.  The Guide describes this in:

    http://docs.racket-lang.org/guide/module-basics.html

Although it's possible to define modules on-the-fly, for simplicity,
you probably should stay with putting the contents of modules in
files.


Racket at the command line should work as well:

#################################################
kui ~ $ cd units
kui ~/units $ ls
simple-factory-unit.rkt  toy-factory-sig.rkt  toy-store-sig.rkt
toy-store-unit.rkt
kui ~/units $ racket
Welcome to Racket v5.2.1.
> (require "simple-factory-unit.rkt")
> (invoke-unit simple-factory@)
Factory started.
#################################################


Posted on the users mailing list.