[racket-dev] submodules

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Mar 9 18:06:47 EST 2012

Just now, Jay McCarthy wrote:
> I just pushed...
> 
> - module**
> 
> Like module* but combines multiple occurrences of the same submodule
> name into one module*

But... it adds more stars...  I don't think that there's any need for
a convenience macro that does just the combining, since that feature
is for macro writers anyway.  Here's what I have in mind:

  (sub main (printf "Welcome to MY library!\n"))
  (sub tests (require tests/eli-tester)
             (printf "Testing..."))
  (define (plus x y) (+ x y))
  (sub tests (printf ">>> ~s\n" shuffle))
  (sub main (printf "Running tests...\n")
            (require 'tests)
            (printf "Goodbye.\n"))

I have it almost working -- I just have one problem left (that last
nested require doesn't work).


> - when-testing
> 
> An abbreviation of module** with the name test and the #f language

(... As I wrote the above, I realized that `tests' is a better name
for this.)

In any case, I think that the above is lightweight enough that there
is no need for any `when-something'.  (I dislike specific names
because there's more than just testing.)


> - raco test
> 
> Finds all the files in a directory and requires their test module

(And it works for the specified path(s) if given?)

How about generalizing this too?  Something like

  raco run tests <path/s>

This way, you get the others for free since `tests' is not hard
wired:

  raco run extensive-tests <path/s>
  raco run docs <path/s>
  ...

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.