[racket-dev] submodules

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Mar 8 15:53:32 EST 2012

On Thu, Mar 8, 2012 at 1:41 PM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:
> Maybe a pattern that could avoid this is to have something like
> #lang racket/main
>  #:main "driver.rkt"
>  #:tests "tests.rkt"
> which would bring in the given modules (in the filesystem) as
> submodules.  That way you could define submodules separately  but still
> package them together in order to follow any protocols for documentation
> or unit testing that come about with submodules. Is that implementable
> with submodules?

Yes. I just tested this idea.

You could expand to:

#lang racket/base

(define (f x) 1)

(module* test #f
  (require racket/include)
  (include "include-tests.rkt"))

(require rackunit)
(check-equal? (f 1) 1)
(check-equal? (f 3) 2)

Although I personally don't like it as much :)


Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the dev mailing list.