[racket-dev] Wrapping loops for TR isn't working, and the type annotations are for the wrong value
On Tue, Aug 14, 2012 at 11:52 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
>
> Some typed "for" loops would have to be reimplemented, unless inference
> improves a lot. To make this easier, I've attached an example implementation
> of `for/vector:' and `for*/vector:'. It allows both body and result
> annotations, handles #:length properly, allows #:when clauses anywhere, and
> fixes the two bugs in `for/vector' I reported today.
Thanks for doing this. I worry a little about re-implementing
`for/vector`, since now we have two implementations to keep in sync.
Eventually, I think Typed Racket needs to support more agressive
inference than it currently does; that's the reality of dealing with a
macro-generated language. But for the moment, this would make things
better for people.
Two questions: (1) how similar is the generated code to the expansion
of plain `for/vector`, and (2) would it be possible to abstract the
implementation of Racket's `for/vector` to allow you to re-use some of
that code here?
--
sam th
samth at ccs.neu.edu