菱形语言 1.0
Rhombus Language 1.0

原始链接: https://blog.racket-lang.org/2026/06/rhombus-v1.0.html

Rhombus 1.0 版本是一种基于 Racket 生态系统构建的全新通用、函数式且可扩展的编程语言。Rhombus 旨在弥合传统易用语法与 Lisp 风格元编程强大功能之间的差距,为日常脚本编写和大规模系统开发提供了一种现代化的选择。 与那些需要在易用性和可扩展性之间做选择的语言不同,Rhombus 在提供常规语法的同时,保留了 Racket 最先进的宏功能。相比标准 Racket,它引入了多项重大改进,包括增强的数据结构、全新的类系统、普遍的模式匹配以及灵活的静态信息处理方式。 Rhombus 旨在用于生产环境,并充分利用了 Racket 稳定且久经考验的基础设施。其设计理念根植于这样一个信念:元编程和领域特定语言(DSL)支持对于现代软件构建至关重要,这对人类开发者和自主编码代理都有益处。通过提供功能丰富的底层语言和开放的编译器 API,Rhombus 旨在提升编程的讨论水平,让构建能够随用户需求共同进化的定制化工具变得更加容易。 如需了解更多信息并开始使用,请访问 [rhombus-lang.org](https://rhombus-lang.org/)。

Rhombus Language 1.0 正式发布,标志着基于 Racket 的生态系统迈出了重要一步。Rhombus 的设计初衷是比传统 Racket 更易于上手,它引入了可读性更强、基于缩进的语法,旨在降低那些不习惯 S-表达式的开发者的入门门槛。 该语言的特色在于其“开放式编译器 API”,允许进行广泛的定制和宏扩展。关于此次发布的 Hacker News 讨论反映了编程社区的分歧:支持者强调使强大且具备宏扩展能力的语言惠及更广泛受众的重要性,而批评者则对放弃 S-表达式并引入重要空白字符的做法持怀疑态度。尽管存在争议,但此次发布凸显了在提升开发者体验的同时,推动 Racket 功能现代化所做的不懈努力。
相关文章

原文

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.

Here are some benchmarks.

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.

联系我们 contact @ memedata.com