[racket] Heads up for TR users #2: new special forms

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Thu Feb 20 00:35:40 EST 2014

Hi all,

Along with the prefix/->* types I mentioned previously, there's another
major syntactic change in Typed Racket which we plan to include in the
release after v6.0.

On git HEAD, Typed Racket now provides its own `lambda`, `define`,
`let`, etc. forms with the same names as the Racket equivalents but
allow optional type annotations in binding positions.

For example:

  -> (lambda (x) x)
  - : (-> Any Any)
  #<procedure>
  -> (lambda (x [y : Integer]) y)
  - : (-> Any Integer Integer)
  #<procedure>
  -> (lambda ([s : String] [x : Integer 0]) x)
  - : (->* (String) (Integer) Integer)
  #<procedure>
  -> (lambda #:forall (A) ([x : A]) x)
  - : (All (A) (-> A A))
  #<procedure>

All of the old forms like `lambda:` and `for:` will continue to work,
but for new code the forms without the : may be preferable.

There are some additional features that come with the new forms, like
return type annotations for lambdas, better optional argument function
type-checking, and so on.

Please let us know if you have any feedback about this change. (bug
reports also appreciated)

Cheers,
Asumu

Posted on the users mailing list.