Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

Flexible Metaprogramming with Rhombus

Rhombus is a new language on the Racket platform with a flexible macro system for compile-time code manipulation, combining powerful metaprogramming with a Python-like syntax. It enables custom syntax extensions and domain-specific languages while maintaining static guarantees.

Background

- Rhombus is a new language being designed by the Racket core team (PLT Inc.), intended to eventually replace Racket's existing S-expression syntax while keeping Racket's macro system and runtime. - Racket is a dialect of Lisp/Scheme known for its powerful macro-based metaprogramming; its syntax uses parentheses (S-expressions), which many find unfamiliar or noisy. - Rhombus keeps Racket's macro engine but introduces a more conventional, Python/Rust-like syntax with curly braces, infix operators, and flexible term rewriting — blurring the line between normal code and syntactic macros. - Key innovations described in this 2025 update include "term metafunctions" (compile-time functions that rewrite arbitrary syntax), custom operators with user-defined precedence and associativity, and a new "expression metafunction" form called `~( )` for inline macro-like syntax. - This matters because Rhombus aims to make Racket-class metaprogramming accessible to programmers who find Lisp macros daunting, without sacrificing the power that makes Racket unique for building programming languages.

Related stories