[racket] weird behavior with in-range in typed racket

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Fri Feb 6 14:05:51 EST 2015

On 2015-02-05 21:20:34 -0800, Alexis King wrote:
>    Anyway, it looks like the TR expansion of for loops doesn’t account for
>    the (rather large) type of in-range. I think Asumu’s rewriting the loops
>    in TR, though—perhaps this will be fixed then?

I have a semi-working rewrite of the for loops, but I don't want to get
people's hopes up quite yet because I'm not sure it's the right

More specifically, since it involves re-writing the `for` macros and
then doing a custom typechecking pass afterwards, it means that the
optimizer can't work straightforwardly on the expansion. (i.e., the
optimizer would need special casing for `for` too)

Also, it's probably not quite sound because it doesn't account for
custom sequence syntax defined via `define-sequence-syntax` in that it
assumes the expr form and the clause forms will typecheck to the same
thing (which does not hold in general).

It might be better to just coax the expansion more to be type-checkable
or maybe to improve type inference.


Posted on the users mailing list.