[racket] Support for keyword functions in Typed Racket

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sat Jun 2 18:35:45 EDT 2012

The highlight (with apologies to Jacob):

#lang typed/racket
(: add-blaster : Number [#:y Number] -> Number)
(define (add-blaster x #:y [y 5]) (+ x y)

(add-blaster 1)
(add-blaster 2 #:y 7)

The details:

Typed Racket now supports defining typed functions with keyword (and
optional) arguments.  To use this support, just write code as above,
the same way you'd write TR functions normally.  The typechecker
should be able to figure everything out.  If it doesn't, please file a
bug report.

There are a couple limitations, which we will remove eventually.
First, `define:`, `lambda:`, and other such forms don't handle the
keyword syntax.  Thus, you need to use out-of-line annotations, as
shown above.  Second, the error messages you'll get when you have
arity errors in the definition are suboptimal at the moment, and
expose some of the implementation.

Try it out, and let me know if anything doesn't seem to work right.
-- 
sam th
samth at ccs.neu.edu

Posted on the users mailing list.