Skip to content
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

Remove Reserved library #4302

Closed
pekkaklarck opened this issue Apr 7, 2022 · 4 comments
Closed

Remove Reserved library #4302

pekkaklarck opened this issue Apr 7, 2022 · 4 comments

Comments

@pekkaklarck
Copy link
Member

The Reserved library contains keywords For, While, Break, Continue, End, If, Else, Elif, Else If, and Return. Using them fails with a message telling that the keyword name is reserved and some keywords also instruct how to use the actual FOR, IF, etc. syntax.

We added the library ages ago to avoid problems if new syntax is added. Now all the syntax there (and more!) has been added so there's no need to reserve anything. When we added IF in RF 4.0, we also made a decision to require all this kind of syntax to be upper case. That makes it mostly unnecessary to reserve possible new syntax because even if we'd add something like CASE, there would be no problem using keyword Case.

When this library is removed, using a keyword like Continue will continue to fail, but the error message changes from 'Continue' is a reserved keyword. to No keyword with name 'Continue' found.. With keywords containing usage instructions, like If that currently fails like 'If' is a reserved keyword. It must be an upper case 'IF' when used as a marker., the new error isn't as informative as earlier. I would say we can nowadays expect users to know that this kind of syntax must be upper case so this isn't a big deal. If we were to report such errors to users, we should detect them already at parsing time anyway to make errors easily available for IDEs and other tools using Robot's parsing modules.

A benefit of removing the Reserved library is that in some contexts the current custom error message is pretty confusing. For a concrete example, see #4297.

@Pratapreddy1188
Copy link

Instead of removing, May be we could simply make all of the keywords to Uppercase and keep appending newly added.

@pekkaklarck
Copy link
Member Author

What benefits would that bring?

@pekkaklarck pekkaklarck modified the milestones: v5.1, v5.2 Jun 29, 2022
@yanne yanne modified the milestones: v6.1, v7.0 Jan 3, 2023
@yorgoA
Copy link

yorgoA commented Jun 8, 2023

so technically we can't use IF anymore ?

@pekkaklarck
Copy link
Member Author

This issue doesn't affect using IF at all. It's recognized as a control structure already by the parser and never considered a keyword. If you use If (not all caps), the error message will change as explained above. If you happen to actually have your own keyword with name If, using it will work exactly as earlier.

@yanne yanne self-assigned this Sep 9, 2023
@yanne yanne closed this as completed in c1597bc Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants