Skip to content

Commit 7ef6540

Browse files
committed
add section about RFC 88
1 parent abfc9f2 commit 7ef6540

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

text/0000-macro-metavar-expr.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,20 @@ similar `${...}` syntax for values based on variables: for example `${#var}`
315315
is used for the length of `$var`. This means `${...}` expressions should not
316316
seem too weird to developers familiar with these scripting languages.
317317

318+
A proposal for counting sequence repetitions was made in [RFC 88]. That RFC
319+
proposed several options for additional syntax, however the issue was
320+
postponed to after the 1.0 release. This RFC addresses the needs of RFC 88,
321+
and also goes further, as it proposes a more general syntax useful for more
322+
than just counting repetitions, such as obtaing the index of the current
323+
repetition. Since the generated values are integer literals, it also
324+
addresses the ability to index tuples in repetitions (using `tup.${index()}`),
325+
which was noted as an omission in RFC 88. It's also not possible to implement
326+
efficiently as a procedural macro, as the procedural macro would not have
327+
access to the repetition counts without generating a sequence and then
328+
counting it again.
329+
330+
[RFC 88]: https://github.com/rust-lang/rfcs/pull/88
331+
318332
# Unresolved questions
319333
[unresolved-questions]: #unresolved-questions
320334

0 commit comments

Comments
 (0)