-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[WIP] Allow macros in identifier position #14266
Conversation
cc me @sfackler |
This probably needs an RFC. |
@huonw I can try putting together an RFC if necessary. Is it the grammar changes that are concerning? |
And the interactions with hygiene. |
Closing, this change is definitely one that warrants an RFC. This looks pretty awesome, however, and I would love to see this implemented! Some thoughts that may affect the writeup of the RFC:
There may be other concerns, but I'm sure an RFC would flesh them out! |
@bgamari, @alexcrichton: So why was this PR abandoned? Were there any technical problems with it, or just the absence of an RFC? |
Ah sorry, my memory is a little hazy on this, but I believe it would definitely need to start out with an RFC today. |
There was an RFC and it was rejected. Though it doesn't point to this PR specifically (which is technically superior in that it doesn't increase the size of It seems a bit odd to me that it was, because we have since added pattern macros and trait/impl interior macros (i.e. macros that can expand to methods or associated items). Making ident macros unstable to use should avoid any de facto problematic design stabilization. |
I don't quite understand how UFCS resolves the desired syntax sugar from my comment in that RFC (if it's meant to). I specifically want a sugaring that looks like this: |
@SiegeLord I don't see how that's relevant, you seem to want something which doesn't expand to a single identifier. I am talking about identifier macros in method name position, which caused some issues during the implementation of this, though I don't see them mentioned anywhere now. |
Oh, I think this was is about conflicts between ident macros and hypothetical method macros (which you seem to be referring to). In which case, what I meant about UFCS is that it removes the requirement for the former (you wouldn't use ident macros for methods outside of macros yourself, I wouldn't think), leaving the obvious syntax for the latter. |
So shall we reopen the RFC (and this PR)? Not being able to create new idents in macros is annoying. |
feature: Make replace_or_with_or_else assists more generally applicable
This allows macros to be used in identifier position of items, making
concat_idents!
far more useful. This is very much a work in progress.