← 返回日报
精读 预计 6 分钟

Rhombus v1.0: A Racket flavored language with syntax

摘要

文章宣布 Rhombus v1.0 发布,并通过 FAQ 与设计说明系统介绍其定位。Rhombus 是基于 Racket 的通用动态语言,强调函数式编程、良好性能、实用库以及从脚本到大型系统的扩展能力。其核心卖点不是语法本身,而是语言可扩展性:希望保留 Racket / Lisp 传统中强大的宏与元编程能力,同时摆脱以括号和 S-expression 为中心的表面语法。 文中详细解释了 Rhombus 与 Racket 的关系:它运行在 Racket 生态之上,可视作类似 Elixir 与 Erlang、Kotlin 与 Java 的关系;但也可以理解为 Racket 多语言生态中的一种语言。相比 #lang racket,Rhombus 不仅更换语法,还引入改进的数据结构、新类系统、广泛模式匹配、层级命名空间以及可扩展静态信息机制等。 作者专门讨论了宏、DSL 与元编程,认为编译期元编程是软件构建的重要基础,Rhombus 希望将 DSL 能力自然嵌入通用语言,而非依赖孤立的小语言。文章还回应了 “AI 时代是否还需要新语言” 的问题,提到截至 2026 年 5 月,编码代理已经能够生成较为地道的 Rhombus 代码。 最后列出一批实际项目与示例,包括基于 Rhombus 构建的新语言 Pille、教学语言 Shplait、桌游项目 Economancy、HTML5 解析器、绘图库封装以及演示与动画相关的大型代码库,用来展示 Rhombus 在语言构建、函数式编程和实际工程中的应用。

荐读理由

Rhombus 0.1 直接可用,#lang rhombus 切换语法就切换模块,结合 Racket 生态资源与多语言基础能力,能在 AI 工程项目中快速迁移并扩展

原文

Rhombus v1.0

Rhombus version 1.0 is now available!

Rhombus major contributors: Mashfi Ishtiaque Ahmad, Taylor Allred, Nia Angle, Wing Hei Chan, Stephen De Gabrielle, Robert Bruce Findler, Jacqueline Firth, Matthew Flatt, Oliver Flatt, Kiran Gopinathan, Ben Greenman, Siddhartha Kasivajhula, Alex Knauth, Jay McCarthy, Lucas Myers, Alec Mills, Sam Phillips, Sorawee Porncharoenwase, Jens Axel Søgaard, and Sam Tobin-Hochstadt.

Rhombus Goals

Modern programming languages reflect a consensus on the the most important programming concepts, including lexically scoped variables, closures, objects, pattern matching, and type parametricity. Why, then, yet another programming language?

Beyond the basics, there are still more good ideas for programming constructs than can fit in any one language specification. Furthermore, specific domains benefit from language support that is tailored to the domain. Language extensibility helps to balance the competing goals of a manageable language size versus fit-to-purpose for a wide range of tasks.

Many newer languages include a macro system to enable extensibility, but other macro systems have not achieved the expressiveness and fluidity of macros as they exist within the Lisp tradition, which includes Racket. At the same time, that expressiveness has been difficult to detangle from Lisp’s minimalistic, parenthesis-oriented notation.

Rhombus is designed to be

  • approachable and easy to use for everyday purposes (that do not need macros), which in part means a conventional syntax; and

  • as extensible as Racket, while making Racket’s state-of-the-art facilities more consistent and accessible to a wide audience.

Frequently Asked Questions

  • What kind of programming language is Rhombus?

Rhombus is a general-purpose, functional, extensible programming language with good performance, extensive documentation, and practical libraries. It’s a dynamic language that offers interactivity and flexibility, but it also has the static and abstraction-enforcing constructs that are needed to scale from small scripts to large systems.

  • Aren’t there a lot of languages like that already?

While there are many small things we think are unique to Rhombus, including compact repetitions using ellipses (…) and a default set of functional data stuctures with good asymptoptic complexity, the big difference is extensibility. See Rhombus Goals.

  • Is it fast?

Here are some benchmarks.

  • How do I get started?

See Getting Started.

  • Do I have to use DrRacket?

The DrRacket programming environment is the easiest way to get started, but see Magic Racket for VSCode or Racket mode (with its racket-hash-lang-mode major mode) for Emacs.

  • What is the relationship of Rhombus to Racket?

Rhombus is built on Racket, and it relies on many Racket tools, including the DrRacket programming environment and the raco command-line suite. Roughly, the languages are related in the same way as Elixir and Erlang or Kotlin and Java.

Then again, it would be fair to say that Rhombus is just Racket, because Racket is meant to be a multi-language ecosystem, and simply starting a Racket module with #lang rhombus instead of #lang racket makes it a Rhombus module. Rhombus, in turn, is meant to push Racket’s multi-language capabilities forward and enable more languages and dialects that are built on Racket and Rhombus.

  • Rhombus is simply Racket with a different syntax, right?

A new syntax reflects the main goal of Rhombus, but #lang rhombus also improves on #lang racket in other ways: better predefined data structures (especially lists), a new class system, pervasive pattern matching, extensible static information as a new point on the spectrum of contracts to types, hierarchical namespace organization, and more.

These general language improvements could have been implemented for a Racket dialect that’s based on S-expressions, but language–syntax codesign for Rhombus opened more possibilities and produced a whole that’s greater than the sum of the parts.

  • Rhombus is Racket without S-expressions, so the syntax is not homoiconic, right?

Hello, fellow Lisper! Rhombus has a bicameral syntax, where the analog to the S-expression layer is shrubbery notation. This is an important part of Rhombus’s approach to macros and metaprogramming. You might be amused by this little metacircular interpreter.

  • Is Rhombus useful only if I want to get into extensible languages, domain-specific languages (DSLs), and/or macros?

Using Rhombus does not necessarily mean writing macros, because Rhombus gives you everything you expect (and probably a lot more) in the base language. The fact that a rich base language is made possible by macro extensibility could be considered an implementation detail or an academic concern. If you enjoy functional, dynamic languages and are interested in a modern synthesis, Rhombus might be for you.

  • Are macros actually a good idea?

The design of Rhombus reflects a conviction that metaprogramming is fundamental to software construction, and that the most effective approach to metaprogramming is one that is integerated with a general-purpose language.

In particular, accomodating domain-specific languages (DSLs) within a general-purpose language avoids some common DSL pitfalls, such as siloed languages that are difficult to integrate into an application, or half-baked abstraction constructs added to a DSL that itself inevitably needs to evolve. Meanwhile, taking metaprogramming seriously benefits not only DSLs, but also metaprogramming tasks such as documentation, analysis, and tool support.

The term macro conjures a variety of meanings and connotations. The approach taken in Rhombus might be more precisely characterized as compile-time metaprogramming or an open-compiler API, but its origins are in Lisp-style macros.

  • Is Rhombus an academic language? A research language? A teaching language?

Rhombus is rooted in academia, but it is not a teaching language, and it is not just a research language. It is intended for production use.

Rhombus cannot yet provide the wealth of libraries available for the most widely used languages. But as an outgrowth of Racket, it has the resources and community needed to persist and evolve. Users should expect a similar level of stability, consistency, and support that Racket has offered for decades.

  • Do we need new programmings languages or DSLs in an age of autonomous coding agents?

Who knows?

A common early prediction around AI coding was that it would spell the end of new languages, because AI would only be able to use the most popular languages as represented in training data. That prediction has not panned out. As of May 2026, (even before Rhombus 1.0), coding agents are pretty good at writing idiomatic Rhombus code. Maybe good documentation helps.

As for DSLs, it seems possible that raising the level of discourse in programming is good for human programmers, good for autonomous programming agents, and good for conversations between them. In that case, we’ll want languages with better DSL support, and that is Rhombus’s goal.

Example Rhombus Programs

The Rhombus web page at https://rhombus-lang.org/ includes a carousel of short examples.

For larger and real-world examples, it’s still early days, but Rhombus contributors have used Rhombus themselves for a number of tasks — including, of course, libraries in the Rhombus distribution.

  • Pille is a new language that is built on Rhombus. It exercises Rhombus’s language-building facilities while using LLVM as a back end. This is a metaprogramming-heavy example.

  • Economancy is a tabletop game with Rhombus implementations of a referee, player programs, and a minimal GUI interface, all implemented in Rhombus as part of a course on functional programming. It demonstrates everyday functional programming with Rhombus.

  • rhombus-html-lib is a package included with Rhombus. It provides a full HTML 5 parser that was AI-implemented following the HTML 5 specification. The implementation is more Java-style and imperative than ideal for Rhombus code, and there’s room for performance improvement, but it demonstrates a sizeable use of Rhombus.

  • Slides for a networking and security were all implemented in Rhombus and its animated-picture library, pict. Slide code is not typical, and as some of the oldest Rhombus code, it’s not the most modern, but it’s a substantial code base.

  • pict-demo is even more pict and even more metaprogramming. The repo contains a draft artifact for an upcoming ICFP’26 paper about the pict library. The running example involves animating evaluation steps, and the implementation uses an eval_tree.rhm library that expands a program into a combination of evaluation and animation components.

  • Shplait is another teaching tool: a language that combines ML’s type system and Rhombus syntax. It’s used in the programming languages course at Utah.

  • rhombus-draw-lib is another package included with Rhombus. It wraps and refines the racket/draw library to implement the Rhombus draw version. Like some other Rhombus packages, this one illustrates an approach to reusing Racket libraries.

Lobsters · 4 赞 · 1 评 讨论 → 阅读原文 →

这条对你有帮助吗?