Improve enums and make them more modern with different syntax, enum infer, more enum types #10833
Replies: 6 comments
-
These are absolutely three distinct proposals that would make much more sense to discuss separately |
Beta Was this translation helpful? Give feedback.
-
@AThousandShips i think they are small enough and related enough to discuss first here,then i can make a new proposal when enough feedback for one is made. |
Beta Was this translation helpful? Give feedback.
-
The first one was proposed in #4278 |
Beta Was this translation helpful? Give feedback.
-
So, shouldn't it be a discussion? |
Beta Was this translation helpful? Give feedback.
-
tbh i forgot those existed,but also i asked on the chat instance and it was said if they were small enough,it would be okay to post them all here,but if it's possible to convert this to a discussion,i wouldn't mind |
Beta Was this translation helpful? Give feedback.
-
Enums closer to this (especially the dot notation shorthand, your second recommendation) are something I loved in Swift and would love to see in GDScript.
I think this may already be somewhat how enums are suggested to be handled in GDScript. For example, I work a lot with tweens, and I know that transition type enum values all start with a common prefix: tween.set_trans(.sine) over tween.set_trans(Tween.TRANS_SINE)
# or
tween.set_trans(Tween.TransitionType.TRANS_SINE) |
Beta Was this translation helpful? Give feedback.
-
Describe the project you are working on
Nothing specific, but multiple projects in general could use this and it makes it more consistent with godot's syntax,making the language more modern and specifically the 3rd proposal would be a new feature,these could also be separated into their own proposals if they get enough positive feedback here
Describe the problem or limitation you are having in your project
There are 3 major issues with enums in godot:
additional issues that can be made into their own proposal due to being too big or are just not important enough to list
Describe the feature / enhancement and how it helps to overcome the problem or limitation
@flags
and@bitset
annotations,with flags making them have enumflags behavior,and bitsets allowing for better bit usageDescribe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
1st:
2nd:
3rd
If this enhancement will not be used often, can it be worked around with a few lines of script?
Is there a reason why this should be core and not an add-on in the asset library?
Enums are a core part of the gdscript module of godot.
Beta Was this translation helpful? Give feedback.
All reactions