Macros is an actively used design pattern. 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.

?Years Old

Languages without Macros include java, javascript, kotlin

Languages with Macros include c, clojure, cpp, erlang, factor, honu, nim, racket, rust, scheme

Example from c:

https://gcc.gnu.org/onlinedocs/cpp/Macro-Arguments.html

Example from clojure:

https://clojure.org/reference/macros

Example from cpp:

https://msdn.microsoft.com/en-us/library/503x3e3s.aspx

Example from erlang:

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

Example from nim:

https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#macros

Example from racket:

https://docs.racket-lang.org/guide/macros.html

Example from rust:

https://doc.rust-lang.org/book/ch19-06-macros.html

Example from scheme:

https://en.wikibooks.org/wiki/Scheme_Programming/Macros

Last updated August 9th, 2020

Edit Macros on GitHub