My problem looks the same as Provide an example using “eval-syntax” & “syntax” in typed/racket, but isn't reading/parsing and type-checking going on at the same time? Or, doesn't this behaviour break the Scheme motto that code is data (or data is code)?
A racket prompt in drracket produces:
> (eval (with-input-from-string
"(begin
(define x 234)
(define y 432))"
read))
> x
234
> y
432
>
whereas a typed/racket prompt shows this:
> (eval (with-input-from-string
"(begin
(: x Integer)
(define x 2))"
read))
> x
. Type Checker: missing type for identifier;
consider adding a type annotation with `:'
identifier: x in: x
> (begin
(: z Integer)
(define z 222))
> z
- : Integer
222
If I create a module and then require it, it works, too:
> (eval (with-input-from-string
"(module temp typed/racket
(provide (all-defined-out))
(begin
(: x Integer) (define x 6)
(: y Natural) (define y 7)))"
read))
> (require 'temp)
> x
- : Integer
6
> y
- : Integer [more precisely: Nonnegative-Integer]
7