[racket] Typed-Racket: provide and mutable variables

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Sun Oct 26 19:30:19 EDT 2014

Hi Wayne,

On 2014-10-26 14:59:59 -0700, Wayne Iba wrote:
>    The result of running testuntyped.rkt is two "initial"s and one
>    "new-name".  If I change the lang of testtyped.rkt to just racket (and
>    remove the type annotations), running testuntyped gives me the expected
>    one "initial" and two "new-name"s.

I believe you are seeing this behavior because Typed Racket uses the
contract system to enforce the types on the exports, and as a result you
are hitting the limitation documented here:

http://docs.racket-lang.org/guide/contracts-gotchas.html#%28part._.Mixing_set__and_contract-out%29

I think the solution is to just use the accessor function and avoid
referring to the variable directly.

Cheers,
Asumu

Posted on the users mailing list.