Rhombus v1.0: A Racket flavored language with syntax

Rhombus v1.0: A Racket flavored language with syntax

Rhombus v1.0:一种带有语法特性的 Racket 风格语言

22 Jun 2026 Rhombus version 1.0 is now available! Install: https://rhombus-lang.org/download.html More information: https://rhombus-lang.org/ Why a new language? https://rhombus-lang.org/goal.html (copied below) Frequently Asked Questions: https://rhombus-lang.org/faq.html (copied below) Example programs: see below. 2026 年 6 月 22 日,Rhombus 1.0 版本现已发布!安装地址:https://rhombus-lang.org/download.html 更多信息:https://rhombus-lang.org/ 为什么要开发新语言?https://rhombus-lang.org/goal.html(见下文)常见问题解答:https://rhombus-lang.org/faq.html(见下文)示例程序:见下文。

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 的主要贡献者包括: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 以及 Sam Tobin-Hochstadt。

Rhombus Goals

Rhombus 的目标

Modern programming languages reflect a consensus on 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. 许多较新的语言都包含宏系统以实现可扩展性,但其他宏系统尚未达到 Lisp 传统(包括 Racket)中宏所具备的表现力和流畅性。与此同时,这种表现力很难从 Lisp 极简的、以括号为导向的符号体系中剥离出来。Rhombus 的设计初衷是让日常用途(不需要宏的场景)变得平易近人且易于使用,这在一定程度上意味着采用传统的语法;同时它像 Racket 一样具有可扩展性,并使 Racket 最先进的设施对广大用户而言更加一致且易于访问。

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. Rhombus 是什么样的编程语言? Rhombus 是一种通用、函数式、可扩展的编程语言,具有良好的性能、详尽的文档和实用的库。它是一种提供交互性和灵活性的动态语言,但也具备从小型脚本扩展到大型系统所需的静态和强制抽象结构。

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 structures with good asymptotic complexity, the big difference is extensibility. See Rhombus Goals. 难道不是已经有很多类似的语言了吗? 虽然我们认为 Rhombus 有许多独特的小特性,包括使用省略号(…)的紧凑重复语法,以及一组具有良好渐近复杂度的默认函数式数据结构,但它最大的不同在于可扩展性。请参阅“Rhombus 的目标”。

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. 我必须使用 DrRacket 吗? DrRacket 编程环境是入门最简单的方式,但你也可以查看 VSCode 的 Magic Racket 或 Emacs 的 Racket 模式(及其 racket-hash-lang-mode 主模式)。

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 与 Racket 是什么关系? Rhombus 构建于 Racket 之上,并依赖于许多 Racket 工具,包括 DrRacket 编程环境和 raco 命令行套件。粗略地说,这两种语言的关系就像 Elixir 与 Erlang,或者 Kotlin 与 Java。话虽如此,说 Rhombus 就是 Racket 也是公平的,因为 Racket 本身就是一个多语言生态系统,只需将 Racket 模块的开头从 #lang racket 改为 #lang rhombus,它就成为了一个 Rhombus 模块。反过来,Rhombus 旨在推动 Racket 的多语言能力,并支持更多构建在 Racket 和 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 只是换了语法的 Racket,对吧? 新的语法反映了 Rhombus 的主要目标,但 #lang rhombus 在其他方面也对 #lang racket 进行了改进:更好的预定义数据结构(尤其是列表)、新的类系统、普遍的模式匹配、作为契约到类型谱系中新节点的“可扩展静态信息”、分层命名空间组织等等。这些通用的语言改进本可以在基于 S-表达式的 Racket 方言中实现,但 Rhombus 的语言与语法协同设计开启了更多的可能性,并产生了一个大于各部分之和的整体。

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. Rhombus 是没有 S-表达式的 Racket,所以语法不是同像的(homoiconic),对吧? 你好,Lisp 同好!Rhombus 拥有双层语法,其中对应 S-表达式层的是“灌木丛符号”(shrubbery notation)。这是 Rhombus 处理宏和元编程的重要组成部分。你可能会对这个小型的元循环解释器感兴趣。

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. 只有在我想深入研究可扩展语言、领域特定语言(DSL)和/或宏时,Rhombus 才有用吗? 使用 Rhombus 并不一定意味着要编写宏,因为 Rhombus 在基础语言中为你提供了你所期望的一切(甚至更多)。通过宏可扩展性实现丰富的语言基础,这可以被视为一种实现细节或学术关注点。如果你喜欢函数式、动态语言,并且对现代化的综合体感兴趣,那么 Rhombus 可能很适合你。

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 integrated with a general-purpose language. In particular, accommodating 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. 宏真的是个好主意吗? Rhombus 的设计反映了一种信念:元编程是软件构建的基础,而元编程最有效的方法是将其与通用语言集成。特别是,在通用语言中容纳领域特定语言(DSL)可以避免一些常见的 DSL 陷阱,例如难以集成到应用程序中的孤立语言,或者添加到必然需要演进的 DSL 中的半成品抽象结构。同时,认真对待元编程不仅有益于 DSL,还有益于文档、分析和工具支持等元编程任务。“宏”这个词引发了各种含义和联想。Rhombus 所采用的方法可能更准确地描述为“编译时元编程”或“开放编译器 API”。