27 Sep 2017

Tutorial: Contributing to Racket

posted by Ben Greenman, with help from Matthew Butterick and Robby Findler and Jack Firth and Vincent St-Amour and Sam Tobin-Hochstadt

This post describes 3 ways to contribute to Racket: (1) fixing a typo online, (2) submitting a pull request to the racket/racket repository, and (3) submitting a pull request to a repository in the Racket GitHub organization.

more →

12 Sep 2017

Racket v6.10.1

posted by Vincent St-Amour

Racket version 6.10.1 is now available from http://racket-lang.org/

Version 6.10.1 patches the recent v6.10 release in three small ways:

  • On Linux, corrects a mishandling of file-stream ports that can block on input or output (such as pipes between processes), where closing a blocked port may cause a port that’s opened later to be incorrectly reported as blocked.

  • On Windows, corrects a crash in the handling of symbolic links.

  • On all platforms, corrects the peer-side results from tcp-addresses.

more →

31 Jul 2017

Racket v6.10

posted by Vincent St-Amour

Racket version 6.10 is now available from http://racket-lang.org/

Note: Graphical Racket programs such as DrRacket are affected by a bug in the Windows 10 Creators update which can lead to blue screens and require reboots. We are aware of the issue, and have mitigated it in DrRacket, which reduces the incidence of crashes. Microsoft has diagnosed the issue and will release a fix in a future Windows update. Additional details are available here: https://github.com/racket/racket/issues/1671

  • Internally, Racket’s intermediate compatibility layer over operating-system facilities has been moved into its own library, “rktio”, so it can be used in future Racket implementations. This change should be transparent, but the refactoring moves code that has many compiler and OS dependencies, so we expect a new glitch or two in less-common build and execution environments. Please report problems at https://github.com/racket/racket/issues.

  • Racket supports cross-compilation of executables in more cases, including executables that depend on packages for foreign libraries.

  • The struct form supports an #:authentic annotation to declare that chaperones and impersonators are never allowed on instances of the declared structure type. This annotation is intended for use on a library’s internal data structures, where it won’t interfere with contracts or other forms of extension at a library’s interface. It can sometimes provide a small performance boost.

  • RackUnit adds nested-info and string-info to grant custom checks more control over the display and layout of check failure info.

  • The raco test command provides the ++arg and ++args flags to pass arguments to tested programs.

  • Typed Racket has types for immutable, mutable, and weak hashtables; in other words the type (HashTable K V) is a union (U (Immutable-HashTable K V) (Mutable-HashTable K V) (Weak-HashTable K V)). Standard library functions may have more specific return types. For example, hash-set has type (-> (HashTable K V) K V (Immutable-HashTable K V)). When an immutable hashtable flows from untyped code to typed code, Typed Racket may use a flat contract to verify its type (provided the table’s key and value types are flat).

  • The Typed Racket Optimizer is disabled in untrusted contexts (e.g., sandboxes). This prevents unsoundness in the Typed Racket type system from being used to get access to unsafe operations.

  • Racket’s internal runtime adds a scheme_atexit procedure with identical behavior as atexit defined in libc.

The following people contributed to this release: Alex Knauth, Alexander McLin, Alexis King, Andrew Kent, Ben Greenman, Ben Noordhuis, Carlo Dapor, Conor Finegan, Daniel Feltey, Ethan Estrada, Georges Dupéron, Gary F. Baumgartner, Gianluca Ciccarelli, Gustavo Massaccesi, Harold Carr, Jack Firth, Jay McCarthy, John Clements, Kimball Germane, Leandro Facchinetti, Lehi Toskin, Leif Andersen, Matthew Butterick, Matthew Flatt, Matthias Felleisen, Michael Orlitzky, Milo Turner, Mohsen Keyhani, Philip McGrath, Robby Findler, Rob Bassi, Ryan Culpepper, Sam Caldwell, Sam Tobin-Hochstadt, Scott Moore, Spencer Florence, Stephen Chang, Stephen De Gabrielle, Vincent St-Amour, WarGrey Gyoudmon Ju, and William J. Bowman.

Feedback Welcome

more →

27 Apr 2017

Racket v6.9

posted by Vincent St-Amour

Racket version 6.9 is now available from http://racket-lang.org/

Security Announcement

A security vulnerability in the racket/sandbox library and Typed Racket allowed malicious Typed Racket code to escape the sandbox. This vulnerability has been fixed in Racket version 6.9. Anyone using racket/sandbox to execute untrustworthy code with access to Typed Racket should upgrade to version 6.9 immediately.

While this known vulnerability has been eliminated, it is possible that similar errors in other installed collections could also be exploited, although we are not currently aware of any existing vulnerabilities. We recommend that if you use the Racket sandbox to execute untrustworthy Racket code, you should also employ additional operating system or virtual machine level protections. The documentation for racket/sandbox has been updated to list recommended security practices for using the library.

Thanks to Scott Moore for identifying this vulnerability.

  • The official package catalog Web site is revised to have a new user experience.

  • The Northwestern snapshot site keeps weekly snapshots going up to 12 weeks into the past. Those provide a middle ground for users who want access to new features earlier than stable releases, but want less churn than nightly builds.

  • DrRacket provides a refactoring tool to remove unused requires in modules.

  • DrRacket’s #lang-line customization support works better with buggy (i.e., in development) languages.

  • The web server’s cookie libraries, including “id cookie” authentication, support RFC 6265.

  • The db library supports PostgreSQL’s UUID type.

  • The raco command lists matching commands when passed an ambiguous command prefix.

  • The bytecode compiler detects more optimization opportunities for structure operations.

  • Scribble can produce output via XeLaTeX as an alternative to LaTeX.

  • Scribble supports the acmart LaTeX style, for use with ACM publications.

  • Scribble supports the use of CJK characters in tags.

The following people contributed to this release: Alex Knauth, Alexander Shopov, Alexis King, Andrew Kent, Asumu Takikawa, Ben Greenman, Daniel Feltey, David Van Horn, Georges Dupéron, Greg Hendershott, Gustavo Massaccesi, Ingo Blechschmidt, James Bornholt, James Whang, Jay McCarthy, Jeff Shelley, John Clements, Jordan Johnson, Leandro Facchinetti, Leif Andersen, Marc Burns, Matthew Butterick, Matthew Eric Bassett, Matthew Flatt, Matthias Felleisen, Michael Myers, Mike Sperber, Philip McGrath, Philippe Meunier, Robby Findler, Royall Spence, Ryan Culpepper, Sam Caldwell, Sam Tobin-Hochstadt, Shu-Hung You, Spencer Florence, Stephen Chang, Tony Garnock-Jones, Vincent St-Amour, WarGrey Gyoudmon Ju, Wei Tang, and William G Hatch.

Feedback Welcome

more →

18 Apr 2017

Type Tailoring

posted by Ben Greenman

Type tailoring is a technique for adding domain-specific type checkers to a typed host language. Using the Type Systems as Macros approach to building typed languages, implementing type tailoring in Typed Racket is straightforward. Any library can apply the core idea, and you can try programming with type tailorings by downloading the trivial package (requires Racket v6.4 or later).

more →

03 Mar 2017

Languages as Dotfiles

posted by Leif Andersen and Ben Greenman

Tired of writing (require (for-syntax syntax/parse)) at the top of your Racket programs? This post shows how to make a #lang to customize your default programming environment.

more →

05 Feb 2017

On Application

posted by Jack Firth

Today I wanted to write about function application. Specifically, how to redefine and customize application with Racket. We’ll also look at some Racket packages that define interesting and useful forms of function application.

The theory

Application is the process of combining a function and arguments to evaluate a result. Application defines one half of lambda calculus, the formal model underlying much of modern functional programming. The other half is abstraction, which is creating new functions. Creating and applying functions is the heart of Racket and many other functional languages.

So how are functions applied in Racket? What makes (if (< 5 10) 'foo 'bar) a macro use and (< 5 10) a function use?

That’s actually a trick question, because function application is a macro in Racket. During macro expansion, the Racket expander inspects the first element of an expression to determine if it has a binding to a macro. If it doesn’t, rather than assume the expression is a function application, the expander inserts an artificial identifier named #%app into the expression. So in the above example, the expression (< 5 10) is converted to (#%app < 5 10). This #%app identifier doesn’t refer to a single specific #%app like the if refers to if from racket/base, rather it refers to whatever the enclosing environment defines #%app to be (which by default means ordinary function application from racket/base).

However, imported modules can provide their own definitions of function application by providing an #%app macro. Let’s define our own #%app that, in addition to applying a function, prints out a trace message. First let’s define a helper function to implement the tracing:

more →

24 Jan 2017

Racket v6.8

posted by Vincent St-Amour

Racket version 6.8 is now available from http://racket-lang.org/

  • Racket sports a new logo, courtesy of Matthew Butterick.

  • MacBook Pro laptops with touch bars are supported.

  • Support for FreeBSD on PowerPC.

  • Initial support for GTK3 on Wayland is available. GL contexts, GC blits, and dialog placement currently do not work.

  • The macro stepper provides a command-line interface via the raco macro-stepper command.

  • Typed Racket more efficiently represents and computes types and propositions, resulting in faster type checking for many programs. For more details, see this blog post by Andrew Kent.

  • The bytecode optimizer can reduce more expressions of the form (equal? x y) to (eqv? x y) or (eq? x y) when the type of x or y is known.

  • The bytecode optimizer avoids dropping stack frames in some reductions. This provides better stack traces for errors when errotrace is enabled.

  • The bytecode compiler detects more optimization opportunities, including when variables always hold a boolean value. In particular in expressions like (or (symbol? x) (something)), the optimizations avoid the creation of an intermediate variable to store the result of (symbol? x).

  • The syntax form preserves syntax properties on all template pieces.

  • The scribble/html/extra module provides renderers for HTML elements that are part of the WHATWG HTML standard but not part of the scribble/html language by default (e.g., map, time, video).

  • The DeinProgramm teaching languages support pattern matching using the match form.

  • In the DeinProgramm languages, define-record-procedures supports specifying signatures as part of the form, instantly enabling properties quantifying over such records.

The following people contributed to this release:

Aleksej Saushev, Alex Knauth, Alexander Hedges, Alexander Shopov, Alexis King, Andrew Kent, Asumu Takikawa, Ben Greenman, Celeste Hollenbeck, Craig Allen, Don March, Georges Dupéron, Gustavo Massaccesi, James Bornholt, Jay McCarthy, Jerry James, John Clements, Juan Francisco Cantero Hurtado, Leandro Facchinetti, Leif Andersen, Matthew Butterick, Matthew Flatt, Matthias Felleisen, Max New, Mike Sperber, Phil Nguyen, Reid D McKenzie, Reuben Thomas, Robby Findler, Ryan Culpepper, Sam Tobin-Hochstadt, Shu-Hung You, Spencer Florence, Stephen Chang, Tim Brown, Tony Garnock-Jones, Vincent St-Amour, WarGrey Gyoudmon Ju, and William G Hatch.

Feedback Welcome

more →

20 Jan 2017

(seventh RacketCon)

posted by Vincent St-Amour


(seventh RacketCon) will be held on October 7th, followed by Racketeer Office Hours on October 8th. This year, RacketCon will be in Seattle, WA, with support from the Racket group at the University of Washington.

RacketCon is a yearly event where members of the Racket community get together, featuring talks and demos about the things you do with Racket.

Racketeer Office Hours is a new event that we’re trying out this year. It is a free-form day for Racketeers to get together and collaborate on ongoing projects, start new ones, and get help and advice from other members of the community.

Registration is not open yet, but we’ll let you know when it is.

See you in Seattle!

Vincent St-Amour, Matthew Butterick, and Matthew Flatt with help from Emina Torlak and Amanda Robles at UW

more →

14 Dec 2016

The redesigned Racket blog

posted by Matthew Butterick

I love Racket. But a few months ago, I really wanted to kill this blog.

Why? Because who reads blogs, right? It’s like getting 4% interest on your savings — so 2006. This is Racket. We’re from the future. No, really. We even have a futures visualizer. Take a look. Do you visualize any blogs?

But my amigo Sam Tobin-Hochstadt had some wise words. “MB,” he said, “we’re not killing the blog. But tell you what: we’ll let you redesign it.”

“OK! Yeah! I’ll show you!”

And this is really Sam’s genius. After you talk to him, not only have you entirely changed your mind, you’ve volunteered to do all the work.

But man, blogs. Have you seen the first blog ever, from 1994? Good news — it’s still online. For the first couple years they were known as personal websites. Then they were called weblogs. Then just blogs. For a while after that, it seemed like everyone was starting a blog. Then everyone was redesigning a blog. Then everyone was ignoring a blog.

Racket didn’t have an official blog back then — this one was started in 2007 — but there are some interesting blog-like records in the archives. For instance, the HISTORY.txt file in the main repo. It chronicles every release back to version 0.27, in September 1995. AFAIK that code is still used today.

Today, blogging persists. But most of today’s tools are calculated to make it as easy as possible. Too easy, perhaps? Not to sound curmudgeonly. But to my mind, the diaristic aspects of blogs were always incidental. Their most important purpose was to give millions of nerds a pretext to learn about web technology. In the ’70s, these nerds were typing out BASIC computer games. These days, I suppose they’re all writing their own JavaScript front-end frameworks. Ten years from now, what — harvesting dilithium crystals in the delta quadrant? (I’m being coy. I do have a futures visualizer.)

So, the Racket blog. My major objection is that until yesterday, it was built on the moldering skeleton of Blogger, which has, against all odds, stumbled into this century. Merely a small cut above Geocities. Surely we Racketeers could do better.

I turned to Greg Hendershott’s static-blog engine Frog. A very slick Racket package that turns Markdown source files into HTML. If you must blog — please try it.

The rest of the design draws on the typography & color themes I used for the Racket documentation — still the best-looking docs in the business. For the headlines, I added something new — the Cooper Hewitt typeface, designed for the namesake Smithsonian museum. Very lovely and totally free.

Thank you to Sam Tobin-Hochstadt, Greg Hendershott, Vincent St-Amour, and Robby Findler for helping me complete this project. As Matthias Felleisen did in his first post for this blog, I dedicate my work “to all things macros and everything else that matters in Racket.”

PS. I did succeed in killing the comments form. Not everything from the ’90s needs to be preserved.

more →

Made with Frog, a static-blog generator written in Racket.
Source code for this blog.