-
Notifications
You must be signed in to change notification settings - Fork 66
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
[Feature Request] Inline initialisation for enum structs #872
Comments
After SourcePawn 1.11, it is possible to do differently by ABC x = {1, 2, 3}; |
I use |
That's not a viable substitute because it requires you to specify the default values each time, which is not necessarily what you want. |
If you can do without the call to init then that's not the kind of use case I'm talking about here. |
I also foresee the need to use the name resolution engine ( |
A constructor might be an option but I feel like it's a more heavy-handed feature request than just "when I create an instance of an enum struct use different initial values or call an inlined init function to set them" |
Very often when using enum structs, it's necessary to have an
init()
method to set all of the values:This is not only clunkier to use
but it's also unnecessary code duplication, and introduces a potential mistake in that you can forget to call
Init()
.The alternative is far simpler and potentially safer:
The text was updated successfully, but these errors were encountered: