66# Summary
77[ summary ] : #summary
88
9- Macros by example 2.0. A replacement for ` macro_rules! ` . This is mostly a
9+ Decalrative macros 2.0. A replacement for ` macro_rules! ` . This is mostly a
1010placeholder RFC since many of the issues affecting the new macro system are
1111(or will be) addressed in other RFCs. This RFC may be expanded at a later date.
1212
1313Currently in this RFC:
1414
15- * That we should have a new macro by example system,
16- * a new keyword for declaring macros.
15+ * That we should have a new declarative macro system,
16+ * a new keyword for declaring macros ( ` macro ` ) .
1717
1818In other RFCs:
1919
@@ -31,14 +31,14 @@ Note this RFC does not involve procedural macros (aka syntax extensions).
3131# Motivation
3232[ motivation ] : #motivation
3333
34- There are several changes to the macro by example system which are desirable but
35- backwards compatible (See [ RFC 1561] ( https://github.com/rust-lang/rfcs/pull/1561 )
34+ There are several changes to the declarative macro system which are desirable but
35+ not backwards compatible (See [ RFC 1561] ( https://github.com/rust-lang/rfcs/pull/1561 )
3636for some changes to macro naming and modularisation, I would also like to
3737propose improvements to hygiene in macros, and some improved syntax).
3838
3939In order to maintain Rust's backwards compatibility guarantees, we cannot change
4040the existing system (` macro_rules! ` ) to accommodate these changes. I therefore
41- propose a new macro by example system to live alongside ` macro_rules! ` .
41+ propose a new declarative macro system to live alongside ` macro_rules! ` .
4242
4343Example (possible) improvements:
4444
@@ -91,14 +91,24 @@ current hygiene system.
9191# Detailed design
9292[ design ] : #detailed-design
9393
94- There will be a new system of macros by example using similar syntax and
94+ There will be a new system of declarative macros using similar syntax and
9595semantics to the current ` macro_rules! ` system.
9696
97- A macro by example is declared using the ` macro ` keyword. For example, where a
97+ A declarative macro is declared using the ` macro ` keyword. For example, where a
9898macro ` foo ` is declared today as ` macro_rules! foo { ... } ` , it will be declared
9999using ` macro foo { ... } ` . I leave the syntax of the macro body for later
100100specification.
101101
102+ ## Nomencalture
103+
104+ Throughout this RFC, I use 'declarative macro' to refer to a macro declared
105+ using declarative (and domain specific) syntax (such as the current
106+ ` macro_rules! ` syntax). The 'declarative macros' name is in opposition to
107+ 'procedural macros', which are declared as Rust programs. The specific
108+ declarative syntax using pattern matching and templating is often referred to as
109+ 'macros by example'.
110+
111+ 'Pattern macro' has been suggested as an alterantive for 'declarative macro'.
102112
103113# Drawbacks
104114[ drawbacks ] : #drawbacks
@@ -123,7 +133,7 @@ breaking backwards compatibility.
123133Use ` macro! ` instead of ` macro ` (proposed in an earlier version of this RFC).
124134
125135Don't use a keyword - either make ` macro ` not a keyword or use a different word
126- for the macros by example syntax .
136+ for declarative macros.
127137
128138Live with the existing system.
129139
0 commit comments