Skip to content

Commit a88bd8d

Browse files
committed
Update the RFC
Only major change is moving from `macro!` to `macro` to declare a macro.
1 parent e177d32 commit a88bd8d

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

text/0000-macros.md

+14-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- Feature Name: macro
1+
- Feature Name: macro_2_0
22
- Start Date: 2016-04-17
33
- RFC PR: (leave this empty)
44
- Rust Issue: (leave this empty)
@@ -19,10 +19,11 @@ In other RFCs:
1919

2020
* Naming and modularisation (#1561).
2121

22-
May be added to this RFC later (or might be separate RFCs):
22+
To come in separate RFCs:
2323

2424
* more detailed syntax proposal,
25-
* hygiene improvements.
25+
* hygiene improvements,
26+
* more ...
2627

2728
Note this RFC does not involve procedural macros (aka syntax extensions).
2829

@@ -50,15 +51,15 @@ fn main() {
5051

5152
mod a {
5253
// Macro privacy (TBA)
53-
pub macro! foo { ... }
54+
pub macro foo { ... }
5455
}
5556
```
5657

5758
```rust
5859
// Relative paths (part of hygiene reform, TBA)
5960

6061
mod a {
61-
pub macro! foo { ... bar() ... }
62+
pub macro foo { ... bar() ... }
6263
fn bar() { ... }
6364
}
6465

@@ -70,7 +71,7 @@ fn main() {
7071
```rust
7172
// Syntax (TBA)
7273

73-
macro! foo($a: ident) => {
74+
macro foo($a: ident) => {
7475
return $a + 1;
7576
}
7677
```
@@ -93,10 +94,10 @@ current hygiene system.
9394
There will be a new system of macros by example using similar syntax and
9495
semantics to the current `macro_rules!` system.
9596

96-
A macro by example is declared using the `macro` keyword with the `!`
97-
operator. For example, where a macro `foo` is declared today as `macro_rules!
98-
foo { ... }`, it will be declared using `macro! foo { ... }`. I leave the syntax
99-
of the macro body for later specification.
97+
A macro by example is declared using the `macro` keyword. For example, where a
98+
macro `foo` is declared today as `macro_rules! foo { ... }`, it will be declared
99+
using `macro foo { ... }`. I leave the syntax of the macro body for later
100+
specification.
100101

101102

102103
# Drawbacks
@@ -119,23 +120,19 @@ Limit ourselves to backwards compatible changes to `macro_rules!`. I don't think
119120
this is worthwhile. It's not clear we can make meaningful improvements without
120121
breaking backwards compatibility.
121122

123+
Use `macro!` instead of `macro` (proposed in an earlier version of this RFC).
124+
122125
Don't use a keyword - either make `macro` not a keyword or use a different word
123126
for the macros by example syntax.
124127

125-
Use `macro` instead of `macro!` (we might want to use bare `macro` for
126-
procedural macros, not clear if the overlap will be a problem).
127-
128128
Live with the existing system.
129129

130130

131131
# Unresolved questions
132132
[unresolved]: #unresolved-questions
133133

134-
What to do with `macro_rules`? We will need to maintain it at least until `macro!`
134+
What to do with `macro_rules`? We will need to maintain it at least until `macro`
135135
is stable. Hopefully, we can then deprecate it (some time will be required to
136136
migrate users to the new system). Eventually, I hope we can remove `macro_rules!`.
137137
That will take a long time, and would require a 2.0 version of Rust to strictly
138138
adhere to our stability guarantees.
139-
140-
There are many questions still to be answered as this RFC and some sister RFCs
141-
are developed.

0 commit comments

Comments
 (0)