-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Use more pythonic syntax with enums #1878
Comments
Python has neither enums nor constants in the core language 🙂 |
@Calinou yes i know but I think the Also unlike arrays and dictionaries, enums and consts enums are more of a scope then a object or variable |
I just realized const enums are actually const dictionaries |
Closing due to lack of support (see reactions on OP and the lack of activity here). |
In fact, the proposal is not very clear, this is its main problem. The main point of this proposal is enum MyEnum:
MY_VALUE_1,
MY_VALUE_2,
MY_VALUE_3, instead of enum MyEnum {
MY_VALUE_1,
MY_VALUE_2,
MY_VALUE_3,
} This is a cosmetic change and I am not against it. I admit, in this case, I got excited. Saving one line is not that important, but it really looks more consistent. An enumeration, unlike an array/dictionary, is a definition, not a value literal, so it is ok that the syntax is different. Moreover, in 4.0-dev named enums are no longer dictionaries. @Calinou, I suggest reopen it. The lack of support in this case is not so obvious. At least, it should be given a second chance. |
@dalexeev Feel free to open a new proposal for this 🙂 |
Describe the project you are working on:
NetworkingTest
Describe the problem or limitation you are having in your project:
Enums and Consts are basicly the same thing but they use a odd syntax for gdscript and enums and const are written diffrentlyRealized const enums are actually dictionaries Xd
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Change enums
and constsso they use this syntaxIt would not only be a cleaner look
EDIT
I want to mention the reason I suggest '=' or
:
is to be easier to understand:
is more of a scope or inheritance thing and=
is more of a assignment thingDescribe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
Above
If this enhancement will not be used often, can it be worked around with a few lines of script?:
This would not only be more pythonic but its more consistent.
Is there a reason why this should be core and not an add-on in the asset library?:
enums
and constsalready are this would just make syntax more consistentThe text was updated successfully, but these errors were encountered: