The Crystal Programming Language Forum

[Blog Post] Crystal Lang: What are Macros and how are they useful?

The Crystal Programming Language includes a feature called Macros. As described by the Crystal Documentation “Macros are methods that receive AST nodes at compile-time and produce code that is pasted into a program.”, to simplify this means you can write code that writes more code. This post is a deep-dive into how to write macros and why they’re useful.

I did this writeup a few days ago on using Crystal macros, they’re overlooked by people new to the language but they are quite useful. Would appreciate any feedback or corrections the community has on this :slight_smile:


Nice! Thanks

1 Like

This is awesome. Thanks!