[racket-dev] In Typed Racket, struct declarations do not work in an internal definition context

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Sat Jan 24 12:24:36 EST 2015

On Thu, Jan 22, 2015 at 3:57 PM, Alexis King <lexi.lambda at gmail.com> wrote:
>
> I can work around this in a variety of ways—I can extract this into an
> untyped module and use require/typed, I can use vectors to “fake” structs
> and provide an appropriate interface, etc. Still, I wonder if there are any
> plans to resolve this type of problem? Since it seems to be an issue with
> how TR handles types at its core, I’m not even sure how feasible it would
> be.


I don't currently have plans to work on this problem. The big issue is
that Racket structs are what's called "generative", meaning that each
time you execute a struct declaration, you get a different struct
type. Thus it's not at all clear what the right type should be for
your `make-me-a-struct` function, and type systems that do allow this
sort of thing (such as ML) would reject this particular use.

Can you say more about the specific issue you're having? There might
be a different way around it.

Sam


Posted on the dev mailing list.