Currently the macro_rules macro is used as the following:
macro_rules! name {
pattern => code;
...
}
Which produces a macro that is used: name!{pattern}.
This proposal would allow for syntax within the macro_rules! macro creator for macros that have some patterns before the initial brackets. I think that it would also be nice if it was possible to control which of the three {}, [], () bracket types were allowed to be used with the with the macro, by default all three would be allowed.
As more information was requested, read below:
Motivation:
For some macros it would make sense for there to be a visual distinction between some parts of the macro. These are generally identifiers or other similar overarching aspects of them.
Explanation:
This is a proposal to facilitate both allowing some pattern matching before the start of the main brackets as well as which type(s) of brackets are allowed to be used. This would act similarly to how the macro_rules macro works where the identifier of the new macro is situated before the start of the brackets that contain the pattern branches.
Example:
Maybe not the best example but I believe that it shows the point rather well
unless! item.is_empty() { continue; }
Instead of something like the following (what is currently available easily):
unless! { item.is_empty() -> { continue; } }
What proposal? This is issue very light on detail making it impossible to understand what is proposed..
@Centril I have added some additional material
A few questions:
macro_rules further given macros 2.0?macro_rules I believe that it should be easily accessible