api-guidelines
api-guidelines copied to clipboard
Type macros may follow a different naming convention
https://github.com/rust-lang-nursery/api-guidelines/issues/135#issuecomment-343698387 suggests a nice one:
I've been using
PascalCase!
for macros that expand into types. (e.g.Array![i32; 5; 4; 3]
which expands into[[[i32; 3]; 4]; 5]
)
I did not consider type macros when adding a case convention for macros in C-CASE. I have also never used a type macro myself. Will need to survey the ecosystem and see whether PascalCase!
for type macros would be a good recommendation.
This seems like an amendment we'd want to make now. In the intervening years I think PascalCase has emerged as a standard for type macros (like syn::Token!
).
@rfcbot fcp merge
@rfcbot fcp merge
This proposes amending our naming conventions to recommend type macros use PascalCase naming instead of snake_case.
Team member @KodrAus has proposed to merge this. The next step is review by the rest of the tagged team members:
- [x] @Amanieu
- [x] @BurntSushi
- [x] @KodrAus
- [x] @dtolnay
- [ ] @m-ou-se
- [x] @sfackler
- [ ] @withoutboats
No concerns currently listed.
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
Are there any type macros in the standard library already?
Yes, there's vec!
and format_args!
, both using snake case instead of pascal case.
Edit: oops, misunderstood the issue
Both of those macros expand into values, not types.
:bell: This is now entering its final comment period, as per the review above. :bell:
psst @KodrAus, I wasn't able to add the final-comment-period
label, please do so.
The final comment period, with a disposition to merge, as per the review above, is now complete.
As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.
The RFC will be merged soon.
psst @KodrAus, I wasn't able to add the finished-final-comment-period
label, please do so.