Rhombus 1.0 Release Notes

Rhombus 1.0 Release Notes

Rhombus 1.0 is now available, providing a general-purpose functional programming language that combines a conventional, approachable syntax with the deep extensibility of the Racket ecosystem. It is designed to bridge the gap between the power of Lisp-style macros and the readability of modern, non-S-expression-based languages.

Core Design Goals and Philosophy

Rhombus aims to provide a modern synthesis of programming concepts—such as lexically scoped variables, closures, objects, pattern matching, and type parametricity—while remaining highly extensible. The primary goal is to allow developers to tailor language support to specific domains without the steep learning curve associated with Lisp's parenthesis-heavy notation.

Rhombus is built on Racket and can be used as a Racket module by starting a file with #lang rhombus. This relationship is similar to how Kotlin relates to Java or Elixir to Erlang; Rhombus leverages Racket's tools, including the raco command-line suite and the DrRacket IDE, but introduces significant improvements over standard Racket, including:

  • Conventional Syntax: A readable indentation-based syntax that is more approachable for everyday use.
  • Improved Data Structures: Better predefined data structures, specifically lists.
  • Enhanced Language Features: A new class system, pervasive pattern matching, and hierarchical namespace organization.
  • Advanced Type System: Extensible static information that exists on a spectrum between contracts and types.

Metaprogramming and the Bicameral Syntax

Rhombus maintains the power of Racket's macro system while removing the requirement for S-expressions. It achieves this through a "bicameral" syntax, where the conventional surface syntax is paired with "shrubbery notation," which serves as the analog to S-expressions for metaprogramming.

This architecture allows Rhombus to implement an "open-compiler API," treating macros as compile-time metaprogramming. This approach avoids the pitfalls of siloed domain-specific languages (DSLs) by integrating DSLs directly into a general-purpose language.

The Ellipsis () Operator

One of the most distinctive features of Rhombus is the ellipsis operator (). Unlike a standard "splat" operator found in other languages, the ellipsis in Rhombus is a macro that allows for compact repetitions. It can work with nested data structures and effectively replace map operations in certain contexts.

"The magic is that Rhombus lets you define different macros depending on whether or not the macro identifier appears in binding context (left side of =), expression context, or some other contexts."

Performance and Implementation

Rhombus lists are implemented using RRB trees (Relaxed Radix Balanced trees). This data structure provides structural sharing and functional updates with $O(\log n)$ complexity for iteration, insertion, deletion, appending, and arbitrary read operations. RRB trees are highly cache-friendly, typically utilizing a base of $\log_{16}$ or $\log_{32}$, which minimizes the constant factor of overhead.

Practical Applications and Ecosystem

While Rhombus is a newer language and does not yet have the library volume of mainstream languages, it is intended for production use and is supported by the Racket community. Current real-world applications include:

  • Pille: A language built on Rhombus that uses LLVM as a back end, demonstrating heavy metaprogramming.
  • Economancy: A tabletop game implementation demonstrating everyday functional programming.
  • rhombus-html-lib: An HTML 5 parser implemented via AI following the HTML 5 specification.
  • pict: An animated-picture library used for networking and security course slides and complex evaluation animations.
  • Shplait: A teaching tool combining ML's type system with Rhombus syntax.

AI and the Future of Language Design

Rhombus developers argue that the rise of autonomous coding agents does not diminish the need for new languages or DSLs. Because Rhombus is well-documented, AI agents have already shown proficiency in writing idiomatic Rhombus code. The creators suggest that raising the level of discourse through better DSL support benefits both human programmers and AI agents, facilitating better communication and collaboration between them.

Sources