Help stabilize a subset of Macros 2.0!

Can you clarify about the hygiene stuff?

  • What exactly does it mean to “stabilize hygiene”? It seems like a fairly nebulous goal.
  • What are “copy-paste hygiene” and “call-site hygiene”? Is this the hygiene that macro_rules experiences today or different?

Moreover, can you elaborate on the concerns that make it more palatable to stabilize proc macros in module-level item position than in any other position? It seems a bit problematic to me if some macros can only be used at module scope. For example, if let’s say something like lazy_static! became a proc macro then I couldn’t use it to declare a function-local static, which is a break from the way other kinds of items work, and it means a user has to care what “kind” of macro it is, which is weird.

For another example, it’s my understanding that std::assert! is becoming a proc macro due to RFC 2011 so if you can’t invoke that as an expression that seems… uh… bad. :slight_smile: And if the answer is that compiler-internal proc macros will be special (I mean, they already are, obviously, like format! and stringify!), I’d just say that it still shows there is clearly a use-case for function-like proc macros.

1 Like