On this page:
Rhombus Metaprogramming Reference
8.16.0.4

Rhombus Metaprogramming Reference🔗ℹ

See Rhombus Reference for information on the base Rhombus language, including basic metaprogramming support in the form of syntax objects and the macro form. This document defines the rest of Rhombus’s metaprogramming facilities.

 import: rhombus/meta package: rhombus-lib

 #lang rhombus/and_meta package: rhombus-lib

Simple pattern-based expression macros can be written using macro without importing any additional libraries besides rhombus, but implementing others forms of macros requires using the rhombus/meta module (usually with no prefix).

The rhombus/meta module provides bindings like defn.macro, expr.macro, and bind.macro. It it also re-exports most of rhombus as meta for use in compile-time expressions, but it omits bindings from rhombus that bridge to meta contexts: meta, macro, binding, etc. Explicitly import rhombus as meta to access the omitted bindings.

The rhombus/and_meta module provides all of the bindings from both rhombus and rhombus/meta. It’s intended for use as a language—an alternative to starting with rhombus and importing rhombus/meta.

    1 Meta Definitions and Expressions

    2 Spaces

    3 General Spaces and Macros

      3.1 Namespace Space

      3.2 Definition Macros

      3.3 Declaration Macros

      3.4 Expression Macros

      3.5 Assignment Macros

      3.6 Binding Macros

      3.7 Annotation Macros

      3.8 Static Information

      3.9 Dot Providers

      3.10 Repetition Macros

    4 Form-Specific Macros

      4.1 Import Macros

      4.2 Export Macros

      4.3 For Clause Macros

      4.4 Sequence Macros

      4.5 Reducer Macros

      4.6 Class, Interface, and Veneer Clause Macros

      4.7 Unquote Binding Macros

      4.8 Syntax Class Clause Macros

      4.9 Syntax Pattern Clause Macros

      4.10 Entry Point Macros

      4.11 Immediate Callee Macros

      4.12 Map Configurations

    5 Syntax Objects

      5.1 Syntax Objects in Macros

      5.2 Syntax Parameters

      5.3 Syntax Object Maps

    6 Operator Orders

    7 Documentation Metadata