Skip to content

Commit 7dcb737

Browse files
committed
Use 'declarative macro' and add note on nomenclature
1 parent f6f5c41 commit 7dcb737

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

text/0000-macros.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
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
1010
placeholder 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

1313
Currently 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

1818
In 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)
3636
for some changes to macro naming and modularisation, I would also like to
3737
propose improvements to hygiene in macros, and some improved syntax).
3838

3939
In order to maintain Rust's backwards compatibility guarantees, we cannot change
4040
the 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

4343
Example (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
9595
semantics 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
9898
macro `foo` is declared today as `macro_rules! foo { ... }`, it will be declared
9999
using `macro foo { ... }`. I leave the syntax of the macro body for later
100100
specification.
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.
123133
Use `macro!` instead of `macro` (proposed in an earlier version of this RFC).
124134

125135
Don'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

128138
Live with the existing system.
129139

0 commit comments

Comments
 (0)