You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unresolved questions to be answered before stabilization
Should the ? Kleene operator accept a separator? Adding a separator is completely meaningless (since we don't accept trailing separators, and ? can accept "at most one" repetition), but allowing it is consistent with + and *. Currently, we allow a separator. We could also make it an error or lint.
I think it depends on experience if this is the right way to solve the problems involved... Frankly, I haven't really written any macros since I implemented this 😛 ...
I think there is still the one problem that was pointed out in the RFC thread: this doesn't provide a clean solution for trailing commas in * macros, since you would end up accepting foo!{,} which is a bit weird.
We could conceivably stabilize this anyway if people find it really useful. Any thoughts?
I personally see it more ergonomic to have rules for () and $(...),+ $(,)? than $(...),* and $(...,)*, as the former usually requires way less duplication than the latter. The former it also natural for recursive macros, and it basically solves the trailing comma problem nicely.
Considering how it also allows optional arguments as well, I think it's pretty much a win here.
As far as the one unresolved question (following separators) goes, I'm in favour of allowing it for the sake of a simpler grammar, but linting it in rustc (not clippy). That seems pretty ergonomic to me, and the compiler internally would have to accept it with a separator anyways to provide useful error messages.
Activity
nikomatsakis commentedon Feb 8, 2018
cc @mark-i-m
mark-i-m commentedon Feb 17, 2018
@nikomatsakis Could you update the checklist? The preliminary impl is available on nightly.
Fix tracking issue RFC 2298 => rust-lang/rust#48075
mark-i-m commentedon Feb 27, 2018
@Centril I think you need to update the tracking issue in the RFC, too 😛
Centril commentedon Feb 27, 2018
@mark-i-m Already done 🤣
clarfonthey commentedon Mar 28, 2018
Is there any plan to stabilise this soon?
mark-i-m commentedon Mar 28, 2018
I think it depends on experience if this is the right way to solve the problems involved... Frankly, I haven't really written any macros since I implemented this 😛 ...
I think there is still the one problem that was pointed out in the RFC thread: this doesn't provide a clean solution for trailing commas in
*macros, since you would end up acceptingfoo!{,}which is a bit weird.We could conceivably stabilize this anyway if people find it really useful. Any thoughts?
clarfonthey commentedon Mar 28, 2018
I personally see it more ergonomic to have rules for
()and$(...),+ $(,)?than$(...),*and$(...,)*, as the former usually requires way less duplication than the latter. The former it also natural for recursive macros, and it basically solves the trailing comma problem nicely.Considering how it also allows optional arguments as well, I think it's pretty much a win here.
clarfonthey commentedon Mar 28, 2018
As far as the one unresolved question (following separators) goes, I'm in favour of allowing it for the sake of a simpler grammar, but linting it in rustc (not clippy). That seems pretty ergonomic to me, and the compiler internally would have to accept it with a separator anyways to provide useful error messages.
Fix tracking issue RFC 2298 => rust-lang/rust#48075
87 remaining items
rfcbot commentedon Nov 20, 2018
🔔 This is now entering its final comment period, as per the review above. 🔔
Centril commentedon Nov 23, 2018
@mark-i-m Since you did the implementation work, could you prepare a PR for the stabilization as well? :)
mark-i-m commentedon Nov 23, 2018
Sure, but it might be a few days before I can get to it
Centril commentedon Nov 23, 2018
@mark-i-m Ah; there's no great rush; 1.32 goes into beta on the 7th. Do you think you can get it landed by then?
mark-i-m commentedon Nov 24, 2018
Yeah, I think I could do it by the end of the week.
Auto merge of #56245 - mark-i-m:stabilize_ques_kleene, r=alexcrichton
mark-i-m commentedon Nov 29, 2018
#56245 has merged