Get the latest tech news

The Macros module is a fictitious module used to document macros


Crystal:: Macros Overview The Macros module is a fictitious module used to document macros and macro methods. You can invoke a fixed subset of methods on AST nodes at compile-time.

By default, the output is tried to be formatted using Crystal's formatter, but you can disable this by passing false to this method. A compile time error is raised if the type/constant does not actually exist, or if a required generic argument was not provided. NOTE the compiler is allowed to cache the executable generated for filename and only recompile it if any of the files it depends on changes (their modified time).

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Macros

Macros

Photo of fictitious module

fictitious module

Photo of Macros module

Macros module

Related news:

News photo

Dtype_dispatch: a macro that defines macros that define enums and match them

News photo

Rhombus: A New Spin on Macros (2023)

News photo

Unhygienic and referentially opaque macros with Scheme syntax-rules [pdf] (2013)