PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Macros

Macros

Macros are a 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, Clojure, Elixir, Erlang, Scheme, Racket, Nim, Factor, Slope, Gerbil Scheme, honu

Example from C:
https://gcc.gnu.org/onlinedocs/cpp/Macro-Arguments.html
Example from C++:
https://msdn.microsoft.com/en-us/library/503x3e3s.aspx
Example from Rust:
https://doc.rust-lang.org/book/ch19-06-macros.html
Example from Clojure:
https://clojure.org/reference/macros
Example from Elixir:
https://hexdocs.pm/elixir/Macro.html
Example from Erlang:
-define(Const, Replacement). -define(Func(Var1,...,VarN), Replacement).
Example from Scheme:
https://en.wikibooks.org/wiki/Scheme_Programming/Macros
Example from Racket:
https://docs.racket-lang.org/guide/macros.html
Example from Nim:
https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#macros
lazy-evaluation-feature.html 路 macros-feature.html 路 manual-memory-management-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com