[racket] Submodule access in nested function definitions

From: Rickard Andersson (rickard.m.andersson at abv.bg)
Date: Wed Mar 18 08:54:54 EDT 2015

Hi, everyone.

So, the background for this e-mail is the following macro:

http://pasterack.org/pastes/51673

In short, it allows me to do function definition closely connected with
contracts as well as test cases.

The problem I ran into last time I worked on this, though, is that I
can't actually use the `define/tc/module` version in nested function.
I'd like to use that version because it adds a "(module+ test
<testcases> ...)" which I consider neater.

I'm looking at this again because I was trying to use Greg
Hendershott's amazing racket-mode for emacs and when you try to autorun
the tests with it you run your test submodule. Tests work fine with
`raco test` but I still want to use the test submodule because it's
neater.

In terms of execution, will not using the submodule hinder anything
else, except not being as easily integrated in, for example,
racket-mode? As per the macro definition, the set of `check-equal?`
calls are just appended after the function definition.

Any advice on how to get around this is appreciated, as is any
information about what 'stray' check-equal?s may mean in terms of risks
to performance, errors and so on.

(Sidenote: Nesting `define/tc` works, but will also run more test cases
than specified.)

// Rickard Andersson [gonz_]

Posted on the users mailing list.