[racket] Typed Racket and require/typed for polymorphic structs

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Wed Aug 7 00:53:25 EDT 2013

I think this could work, but you'd have to be careful about the
possibility that the struct is mutable even if undeclared in the
`require/typed`.

Sam

On Tue, Aug 6, 2013 at 2:56 PM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:
> Hi all,
>
> Does anyone know why Typed Racket does not support importing polymorphic
> structs using the #:struct keyword in `require/typed`? Is this a
> fundamental limitation or just a "small matter of programming"?
>
> i.e., I want to do something like
>   (require/typed lang/posn
>     [#:struct posn (A) ([x : A] [y: A])])
>
> This seems like it could be supported by the contract system in most
> cases (with polymorphic contracts on accessors and constructors). The
> case in which it wouldn't work is if you wanted to export a struct
> instance with a polymorphic type from the untyped module.
>
> Cheers,
> Asumu
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.