Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declarative macro repetition counts #57

Closed
nikomatsakis opened this issue Sep 30, 2020 · 4 comments
Closed

Declarative macro repetition counts #57

nikomatsakis opened this issue Sep 30, 2020 · 4 comments
Labels
lang-initiative An active lang team initiative T-lang

Comments

@nikomatsakis
Copy link
Contributor

Summary

Add new syntax to allow declarative macro authors to easily access the count or index of declarative macro repetitions.

Info

What is this issue?

This issue represents an active project group. It is meant to be used for
the group to post updates to the lang team (and others) in a lightweight
fashion. Please do not use the comments here for discussion, that should be kept
in the Zulip stream (discussion comments here will be marked as off-topic).

@nikomatsakis nikomatsakis added lang-initiative An active lang team initiative T-lang labels Sep 30, 2020
@nikomatsakis
Copy link
Contributor Author

No update this week.

@markbt
Copy link
Contributor

markbt commented Feb 4, 2021

Project update

I've started looking at expanding more on the idea of general-purpose metavariable expressions (${ ... }) for use in extending the macro language, where macro repetition counts are the first user. It's coming together pretty nicely.

For a real-world example, this line in one of my crates would become:

let size = ${count(value)};

There is a prototype implementation on the markbt/rust:metavariable_expressions branch. If you'd like to try it out, any feedback would be welcome.

I've started drafting an RFC on the markbt/lang-team:metavar_expr_rfc branch (Rendered). It's still in its early stages, but feedback and contributions are always welcome.

Cc: @Lokathor @rust-lang/lang

@nikomatsakis
Copy link
Contributor Author

Project update

@nikomatsakis
Copy link
Contributor Author

Closing this in favor of rust-lang/rust#83527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-initiative An active lang team initiative T-lang
Projects
None yet
Development

No branches or pull requests

2 participants