Declarative macros

The next thing that is coming to Rust are declarative macros, macros 2.0, or macros by example. It's true that some call standard macros declarative macros too, since they are based on the same principle. But I wanted to make this difference known so that we learn about some improvements that these new macros will bring to the language.

These new macros introduce the macro keyword, which will work similarly to the macro_rules!{} macro, but using a syntax more close to the function syntax than to the current syntax. Not only that, it will also add modularization to macros so that you can have two macros with the same name in the same crate, as long as they are in different modules. This extra modularization will make integration between crates much easier.

Sadly, there is still no syntax proposition for these macros, and the current nightly implementation is not much more than a placeholder for what is yet to come. I invite you to keep yourself up to date on the standardization of these new macros and even to define a future syntax for them by contributing to the community.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.22.179