Automatic meta scoping affordance

Please just close this issue if these proposals are unreasonable or unfeasible.

Simplifying macro invocation (impossible)

Would it be possible and/or reasonable to replace this

#[derive(Deftly)]
#[derive_deftly(Widget)]

with this

#[derive(Deftly(Widget))]

?

Simplifying metavar collection

As I worked on build-deftly, I found myself saying fmeta(builder(X)) and deftly(builder(X)) a lot, to the point of exhaustion.

Would it be possible to say, when defining the macro, something like:

define_derive_deftly! {
  Builder for struct, with meta_root: builder =
  ...
}

And then use tmeta(X) and fmeta(X) to refer to #[deftly(builder(X))] ? Or even to refer to #[builder(X)] ?

This change would:

  • Make the macros terser and less error-prone to write, since we could just say fmeta(X), and not have to worry about forgetting to say builder.
  • Encourage attribute namespacing.
  • Possibly, make macros easier to invoke, by letting the caller say #[builder(X)].
Edited by Ian Jackson