# Eval seems to behave differently in typed and untyped racket

**URL:** <https://racket.discourse.group/t/eval-seems-to-behave-differently-in-typed-and-untyped-racket/2020>\
**Category:** Questions & Answers\
**Created:** [June 16, 2023, 5:35pm UTC](https://racket.discourse.group/t/eval-seems-to-behave-differently-in-typed-and-untyped-racket/2020 "2023-06-16T17:35:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wurmli](https://avatars.discourse-cdn.com/v4/letter/w/dbc845/32.png) [@wurmli](https://racket.discourse.group/u/wurmli)\
**Post date:** [June 16, 2023, 5:35pm UTC](https://racket.discourse.group/t/eval-seems-to-behave-differently-in-typed-and-untyped-racket/2020/1 "2023-06-16T17:35:07Z")

</div>

My problem looks the same as [Provide an example using “eval-syntax” & “syntax” in typed/racket](https://racket.discourse.group/t/provide-an-example-using-eval-syntax-syntax-in-typed-racket/1662), 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:

```scheme
> (eval (with-input-from-string
          "(begin
             (define x 234)
             (define y 432))"
          read))
> x
234
> y
432
> 

```

whereas a typed/racket prompt shows this:

```scheme
> (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:

```scheme
> (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

```
