plt/racket — pull request #557 by takikawa (2014-01-31 04:29:34+00:00)
Title: Improve TR lambda to accommodate type annotations

This PR rewrites the `lambda` form for Typed Racket.

The new form allows all arguments to have type annotations or no type annotations individually. It also allows optional and keywords arguments where allowed in untyped Racket.

There are a few things that aren't supported:
* Some type annotations don't work because the underlying type-checker for optional arguments cannot handle certain cases. I think I can fix this by using the new `kw-unconvert` helper but with empty keyword lists.
* There are no type annotations for rest arguments because the syntax is tricky.

More on bullet 2: you might want the current `lambda` type annotation for rest arguments to work, but unfortunately it is ambiguous. For example, consider this snippet:

````
(lambda (x . [y : String *]) x)
````

This syntax is ambiguous because the `. [y : String *]` will be parsed first as four separate arguments since arguments without type annotations are allowed. Putting another pair of parentheses around won't work either since that looks like an optional argument. Using three pairs of parentheses works, but looks very ugly.

Any ideas on a syntax for this case?