Proposal: Use member access operator `.` to call a macro
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
// look at this:
log.warn!("Failed to save file \"{}\": {:?}", path.to_string_lossy(), e);
// instead of:
warn!(log, "Failed to save file \"{}\": {:?}", path.to_string_lossy(), e);
log.warn(format!("Failed to save file \"{}\": {:?}", path.to_string_lossy(), e));
There are several advantages: First, it looks more coherent. And second, it can avoid the duplication of macro names (or something related to scope? I'm not very familiar).
Maybe "member macro" can be written like this:
impl Logger {
macro_rules! warn {
($($arg:tt)*) => (write!($self, '[WARN] ', $($arg)*))
}
}
Thanks of its new syntax (macro_rules in impl), I think it will be difficult to implement.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposal's Rust examples for member macro calls and the suggested macro_rules syntax in impl blocks. The issue names no files, tests, or implementation entry points, and does not define a concrete completion criterion beyond evaluating whether this language feature can be implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100