-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Def, macro, and block parameters could end with ?
or !
#10917
Comments
?
or !
?
or !
Interestingly enough I sometimes wish I can use |
I agree on the expectation that This can technically be seen as a parser bug (it unintentionally allows these names). But at this point, it's also a compiler feature (even if undocumented) and changing it could potentially break existing code. I don't think it's urgent to disallow these parameter names, so this should probably wait for 2.0. |
If the parser were updated to show a deprecated warning on these, but still parse, it wouldn't be a breaking change, right? This could be the way forward for compiler changes waiting for 2.0. |
See also: #2617 (comment) |
If this issue is still relevant can I claim it? I found in the parser the piece of code that parses functions. My plan was to add a test and update the code to output a warning in case input code uses ‘?’ or ‘!’ in function parameters identifiers as suggested in the comments to keep the backward compatibility. Does it sound good? |
I've published a #12197 to fix this issue. I decided to raise an exception because I didn't find how to log a warning + test warning message. In |
The following code is valid in Crystal but not in Ruby:
I would expect
?
and!
to always denote a call rather than a variable name.The text was updated successfully, but these errors were encountered: