Racket, a multi-paradigm programming language belonging to the Lisp/Scheme family, has reached version 6.5, writes Ryan Culpepper on Racket blog. The new version adds several new features, including improvements to typed/untyped code interaction, faster iteration on hash tables and sets, and more.
As mentioned, Racket 6.5 speeds up typed/untyped interaction in a number of gradual typing programs, according to Culpepper. This is made possible by improvements to both Typed Racket and the racket/contract
library which now produce lower overhead code.
Hash tables and sets provide now faster iteration when using in-hash
, in-hash-pairs
, in-mutable-hash
and in-mutable-set
functions. According to Culpepper, microbenchmarks show that iteration is now up to 100% faster.
Additionally, Racket's optimizer now detects more optimization opportunities, such as when variables are used to always hold numbers, in which case runtime checks can be omitted altogether.
More changes brought by Racket 6.5 are the following:
syntax-parse
a domain-specific language for writing macros and specifying syntax generates better diagnostics;- contracts have got both better profiler coverage and performance improvements;
- support for multi-result statements in MySQL has been added.
Racket is released under the LGPL license and its official 6.5 version can be downloaded as a tarball or from GitHub. One of Racket’s design goals is to serve as a platform for language creation, design, and implementation. Typed Racket is a statically typed variant of Racket, which, specifically, supports a gradual typing paradigm where both typed and untyped code may coexist.
InfoQ has spoken with Ryan Culpepper about Racket 6.5 announcement.
Could you provide more details about the improvements that Racket 6.5 brings to gradual typing? How did you measure them?
Asumu Takikawa, as part of his dissertation work, developed a measurement framework for typed/untyped interactions. It's described in the POPL 2016 paper "Is Sound Gradual Typing Dead?". Since then, Sam Tobin-Hochstadt and others have improved Typed Racket's contract generation, and Robby Findler has made improvements to the contract library itself, using that measurement framework to find opportunities for improvement and measure their impact. More details can be found in Takikawa's article.
You are the author of syntax-parse
. Could you explain what it brings to Racket’s macro system and how it helps when writing macros?
Syntax-parse allows macro writers to write declarative, modular specifications of syntax, including context-sensitive checks. It automatically generates good error messages for invalid uses of macros, relieving the macro writer of that burden. It also supports more expressive patterns and templates, compared to syntax-case, and it provides an "attribute" mechanism that lets macro writers group parts of the macro's code generation with the syntax specifications. In short: it makes it easier to write good, robust macros.