[racket] Support for keyword functions in Typed Racket
Nice. Thank you.
On Sat, Jun 2, 2012 at 6:35 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>wrote:
> 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
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120602/92f525ae/attachment.html>