Crystal Lang: Macros and how they're useful
Logo of Crystal Language The Crystal Programming Language includes a feature called Macros. Crystal’s Documentation states: “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. What’s an Abstract Syntax Tree (AST)? To understand how Macros work, you should be familiar with the concept of an Abstract Syntax Tree....