As Eric suggests, the contract is created at the place where the require/typed lives. Think of
(define x 1) (define y (* x 2)) for the simplest example. BUT, I wonder whether there is a dual to contract-out, i.e., contract-in On Feb 8, 2013, at 11:20 PM, Joe Gibbs Politz wrote: > When using require/typed with a struct type in the signature, it seems > to matter if the require comes before or after the struct definition: > > typed.rkt > ========= > #lang typed/racket > > (require/typed "untyped.rkt" > [number-me (my-struct -> Number)]) > > (struct: my-struct ()) > > (number-me (my-struct)) > > untyped.rkt > ========= > #lang racket/base > > (provide number-me) > (define (number-me _) 52) > > > Running typed.rkt yields: > > my-struct?: undefined; > cannot reference an identifier before its definition > > But, if I change typed.rkt to > > typed2.rkt > ========= > #lang typed/racket > > (struct: my-struct ()) > > (require/typed "untyped.rkt" > [number-me (my-struct -> Number)]) > > (number-me (my-struct)) > > > There's no error and the call succeeds. > > Any reason for the ordering dependency? It's quite inconvenient to be > shuffling require statements around as soon as you want to put a > struct in their type, so I'm assuming this wasn't intended. > ____________________ > Racket Users list: > http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users