-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Using reserved words as NamedTuple field names #26819
Comments
In a language with elaborate (non-s-expression) syntax it is unavoidable that some surface syntax forms won't be able to express everything the underlying object model can represent. And I don't think we can or should allow parsing One thing we could do is fix the printing of |
I wonder if some of @c42f's work on expression parsing and such would facilitate the requested change in printing here (i.e. printing the long-form NamedTuple instead of |
@quinnj I assume you refer to #32408? With the current syntax from that PR I think we could have I think this would require additional changes to the parser in addition to #32408 and the pretty printer would definitely need more work. But it's a neat connection. |
With #32408 merged we now have
So one part of this is solved. The second part would be to detect reserved words when |
Followup to #26507.
This works:
However, direct construction does not work.
There are also (at least) two different failure modes for different reserved words.
Would it be mad to allow this? Alternatively, could it give a uniform and more specific error about bad use of reserved word in named tuple?
The text was updated successfully, but these errors were encountered: