Languages Features Calendar About Lists Add Language
GitHub icon



Macros are a language feature.

A macro (short for "macroinstruction", from Greek μακρός 'long') in computer science is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to a replacement output sequence (also often a sequence of characters) according to a defined procedure.

Languages without Macros include Java, JavaScript, Kotlin

Languages with Macros include C, C++, Rust, Scheme, Clojure, Erlang, Racket, Nim, Factor, honu

Example from C:

Example from C++:

Example from Rust:

Example from Scheme:

Example from Clojure:

Example from Erlang:

-define(Const, Replacement). -define(Func(Var1,...,VarN), Replacement).

Example from Racket:

Example from Nim:

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements · Email · GitHub