[racket] TR: struct: #:prefab option

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Mon May 6 13:52:57 EDT 2013

On 2013-05-06 13:39:40 -0400, Asumu Takikawa wrote:
> This actually looks like it's a problem even without #:prefab structs:
>   #lang racket/load
>   (module foo racket
>     (struct foo ([f #:mutable]))
>     (define y (foo values))
>     (define (mutater) (set-foo-f! y (λ (x) (string->number x))))
>     (provide y (struct-out foo) mutater))
>   (module bar typed/racket
>     (require/typed 'foo
>                    [#:struct foo ([f : (Float -> Float)])]
>                    [y foo]
>                    [mutater (-> Void)])
>     (mutater)
>     ((foo-f y) 5.3))

Whoops, Vincent pointed out that my claim wasn't quite right. Here, this
is just a type->contract bug, but it would be prevented if the right
contract were applied to `foo-f`.


Posted on the users mailing list.