[racket] require/typed to a struct type

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sat Feb 9 14:31:58 EST 2013

On Sat, Feb 9, 2013 at 2:25 PM, Joe Gibbs Politz <joe at cs.brown.edu> wrote:
> I can't move all of my require/typed declarations to the end of my TR
> files, either, since the declarations are needed before certain uses
> of the bindings I bring in.  Is there a recommended rule of thumb for
> where to put require/typed declarations?

The issue here is that `require/typed` (and also `struct`) is
*computation*, unlike either plain `require` or `define-type`, which
just declare static relationships and can therefore be automatically
shuffled around for you by the system.  Therefore, you have to put it
at the place in your module where the prerequisites of that
computation have happened, and before the places where you need that
computation to happen. There can't be a general rule for that,
although is basically all the cases I've seen, you can put your struct
declarations first, then the requires that depend on them.


Posted on the users mailing list.