Rough agenda
Vincenzo: About 1 year old, created in https://github.com/rust-lang/compiler-team/issues/637. RfL was considering using macros but there wasn't an obvious expert. Was debating whether to use syn
, and if so how.
Got involved with the edition, pair-programmed expr_2021
together.
Eric: I come from Scheme, so I'm a fan of macros. Rust's macros are great but kind of languishing. Want to help building expertise within the Rust community and also establish a macro vision.
Josh: Started in C, but has done other languages with good macro systems. Also, Python decorators are kind of similar. Used Template Haskell and such in a large project. Backwards compatibility is a fun constraint for Rust.
Proc macros were a good, powerful first step, but they have a lot of downsides. We can probably do a lot of small improvements to macro_rules!
. E.g. proc_macro_rules.
macro_rules!
improvements, RFCs, project goalJosh: Making it possible to do attributes and derives with macro_rules!
.
Some people will just use that, but…
Can we add more control flow besides recursion?
$match
, $let
, $for
${ for f in st.fields {
}}
$for f in st.fields {
}
Vincenzo: While working in the kernel I was thinking to somethig like that (https://github.com/rsmicro/kproc-macros/issues/5)
editor!{
@foreach ${attributes} {
println!("{}", ${ir});
}
}
Josh: Can delegate new fragment fields to wg-macros, only use one lang RFC for the general concept of macro fragment fields.
In six month, can wg-macros help implement declarative attribute and derive macros, such that we can make a stabilization report in six months?
Fragment fields could also be used for a new lint system.
Josh to update project goal: