(Meeting attendees, feel free to add items here!)
variant
macrohttps://github.com/rust-lang/impl-trait-utils/pull/2
TC: I've mostly reviewed the PR. The implementation looks good. The only open question I had was over the name:
Regarding the name, I agree that
variant
is a fine thing to callSendIntFactory
, but I'm less sure it's the correct part of speech for the attribute proc macro.It almost seems to be suggesting that
variant(..)
is some kind of property ofIntFactory
rather than that we're creating a new trait variant.Consider, by way of contrast,
derive(Copy, Clone)
. The wordderive
is a verb, and that helps to make it clear that the attribute is deriving a new thing.Perhaps we could call this
derive_variant
?
tmandry: It'd be good for it to be short.
TC: Agreed about that.
TC/tmandry: Perhaps add_variant
or make_variant
would be options.
tmandry: I like make_variant
.
TC: Sounds good to me.
TC: Did we want to update the README in this PR also?
tmandry: Yes, we should do that.
TC: One question I had reading through is whether or not we'd want to add bounds on the associated type. In a sense we don't need to, because like RTN, the user could add the bounds during use.
tmandry: It's a good question. We could add an attribute over the associated type to control this. It might be overly prescriptive to do by default.
TC/tmandry: Do we have a project-managed account for publishing to crates.io
?
Looking at:
It's owned by:
Perhaps we should create a team for rust-lang:async
to use as the owner for this. Maybe T-infra handles this?
Looks like we can convert a GitHub team into a crates.io team.
It's currently called trait_transformer
. That's not correct because trait transformers are meant to be used at the use site, but this has to be used at the definition site. So it's not a polyfil.
We could name it make-variant
if we only ever expect that we'll have this one proc macro in the crate.
Do we have a convention on dashes or underscores in the crate name?
…Looking at the things owned by rust-lang-owner
, it seems like dashes win. E.g. cfg-if
and crates-io
.
Naming options:
trait-variant
trait-variants
(plurality?)make-variant
make-trait-variant
(too long)variant-trait
trait-utils
trait-polyfils
We might think of this as a polyfil for implementable trait aliases. We could have a version of the macro that doesn't output the trait itself, then you could copy and paste the definition from another crate locally. We would need to have an argument for the path to the real trait, then the macro would insert that for the forwarded function calls.
We may have to think about the effect of the blanket impl there.
Let's go with trait-variant
.
Let's look at the full invocation:
#[trait_variant::make_variant(SendFoo: Send)]
It's a bit repetitive, but probably OK.
dyn
Niko has a dyner
repo with prototypes.
The async-fundamentals-initiative
website has some other ideas.
It expands to a variant of the trait…
This has examples:
RPITIT is ready, async is not (but it’s getting there)
The proc macro is a part of this story. Now that there is believed to be a path from using this macro to using implementable trait aliases, we're now actually feeling much more positive about this.
Failed to normalize
async_fn_in_trait
ICE for indirect recursion of async trait method calls" #112047async_fn_in_trait
and return_type_notation
cause awkward awaits" #112569None.