Mind your language

Racket: A language-oriented programming project

Jane Elizabeth
© Shutterstock / focal point

Miscommunication is the source of many coding snafus. Writing clean code isn’t just efficient; it helps out future developers who follow in your footsteps. Today, we take a look at Racket, a project that tries to bridge miscommunications with language-oriented programming.

Getting your point across in code is notorious difficult to do sometimes. Even if you have a clear concept of what you’d like to achieve, making that point understood by your fellow developers is complicated. Language is an imperfect medium to transfer thought: two different people could be using the exact same word but mean totally different things.

Despite these communication barriers, we muddle on through somehow. Part of that is always leaving documentation with your code, so future developers can understand your decision-making process. (Be honest. )

In an ideal world, developers would always choose the perfect language for each problem. In reality, they’re stuck with popular languages or whatever programming language their company prefers. So, how can developers manage the mismatch between domain-specific issues and general purpose languages?

Since programmers are a practical bunch, they use (or build) domain-specific language embedded in the chosen language, like how JavaScript developers use jQuery for interacting with the DOM and React for event and concurrency issues. Basically, they write multilingual software in a common host language.

Unfortunately, this isn’t a universal practice and multilingual software is kind of a pain to work with, between setting up the files and running the tools in a separate language. Plus, it’s extremely unlikely that the host language will properly support these components. IDEs, in particular, do not often support these kinds of embedded domain-specific languages.

SEE MORE: Go beyond object oriented design — Let it flow!


The Racket project is meant to develop the idea of language oriented programming at both the practical and conceptual level. Conceptually, Dr. Matthias Felleisen and his team of grad students at Northeastern University have been trying to see how language-oriented programming will affect software.

On a more practical basis, Racket is meant to develop a programming language that enables language-oriented software design. Racket is both a programming language as well as a set of tools.

“What is code? A lot of people think code is something that manipulates zeros and ones on a computer. That’s not true. Code is something that communicates between people. It’s a piece of information that one developer hands to another. So we are not looking for code to manipulate zeros and ones, we’re looking for code to communicate the idea as clearly as possible to another human being.”

Dr. Matthias Felleisen

SEE MORE: “Stop designing languages. Write libraries instead.”

Language as a building block for software

Racket is a direct descendant of Lisp and Scheme that emphasizes functional over imperative programming. That being said, Racket is agnostic over surface syntax and accommodates conventional variants.

Racket’s main tools are

  • racket, the core compiler, interpreter, and run-time system
  • DrRacket, the programming environment
  • raco, a command-line tool for executing Racket commands that install packages, build libraries, and more.

One of Racket’s more interesting features is that it eliminates the hard boundary between library and language. This means new constructs are seamlessly imported as functions and classes from libraries and packages. Language itself becomes a software building block.

Racket’s modular syntax system is a direct improvement over Lisp and Scheme’s systems. A module can provides for functions, classes, and linguistic constructs. So, creating a new language means creating a module that provides the services for a language. A language doesn’t have to be built from scratch.

Every Racket module specifies its language on the first line, referring to a file that contains a language-defining module. By creating this file, you’ve installed a language into Racket. Development can take place concurrently across multiple tabs within Racket. So, language development is a “friction-free process” in Racket.

Racket also promises sound cooperation across languages through the language implementation itself and in cooperation between two components written in different embedded languages. Developers can equip a language with almost any conventional level of soundness, as found in ordinary language implementations.

They can also exploit a variety of internalized operating system services for constructing runtime libraries for these embedded languages. Racket borrows services from the surrounding operating system and assimilates them into the language itself.

SEE MORE: Concurrency, functional programming, Jigsaw: Is Java fit for the future?

Getting Racket

Interested in trying it out for yourself? Racket is available via download here. Their website has extensive documentation for all developers looking to develop and deploy new languages. Racket is cross-platform and works on Windows, Linux, and macOS: develop on one, deploy to all three.

Jane Elizabeth
Jane Elizabeth is an editor for JAXenter.com.

Leave a Reply

Be the First to Comment!

Notify of