-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Reserve variable starting characters. #6609
base: dev/feature
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could add a suppression option but i don't mind either way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are generally my own thoughts, so please feel free to counter back
} | ||
} | ||
Skript.warning("The character '" + token + "' is reserved at the start of variable names, " + | ||
"and may be restricted in future versions"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that tabs and spaces are being mixed on this line. Two standard indents should suffice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I have a small request
continue check_reserved_tokens; | ||
} | ||
} | ||
Skript.warning("The character '" + token + "' is reserved at the start of variable names, " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see this message in english.lang
. I think it is reasonable for us to provide translation support for these internal messages.
Description
In an upcoming version, we're looking at instituting new special variable types (e.g. unsaved, reference).
No plans are finalised for this, but the first step is reserving the starting characters (like
_
for local variables).The current characters reserved are:
Currently, this will only issue a warning when they're used (but it won't prevent anything loading).
Presumably, in some future version, this will become an error (or the variable will have some special functionality)!
Why these characters?
It was a pretty arbitrary choice, we just picked a handful of special characters to give us some freedom for future changes.
Note 1:
-
minus variableA lot of people use the
(?!-).*
pattern in the config to prevent{-variable}
from being saved at all (i.e. to vanish when Skript terminates).We'd like to institute proper behaviour for an 'ephemeral variable' in the future (rather than just using the config pattern as a patchwork), so that's why we're reserving this character.
However, I've tried to skip the warning IFF you're using this pattern in the config (since there's nothing to warn you about).
Note 2:
*
starStars are already prohibited in variable names (other than in a
list::*
) so this one shouldn't affect anybody.Target Minecraft Versions: any
Requirements: none
Related Issues: none