[racket-dev] submodules
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:
include.rkt:
#lang racket/base
(define (f x) 1)
(module* test #f
(require racket/include)
(include "include-tests.rkt"))
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
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay
"The glory of God is Intelligence" - D&C 93