-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
proposal: ability to specify tag type of enums, and set the tag value #305
Labels
accepted
This proposal is planned.
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Comments
andrewrk
added
the
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
label
Apr 5, 2017
+1 |
I agree, it's a nice feature with intuitive syntax. |
tiehuis
added
the
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
label
Sep 15, 2017
I would love to see this implemented soon. It would make Zig great for programming microcontrollers. |
andrewrk
added a commit
that referenced
this issue
Dec 1, 2017
You can now specify the tag type in enums, as described in this issue. You can also access the tag type with
|
andrewrk
added a commit
that referenced
this issue
Dec 1, 2017
andrewrk
added a commit
that referenced
this issue
Dec 2, 2017
The-King-of-Toasters
added a commit
to The-King-of-Toasters/zig
that referenced
this issue
Mar 16, 2024
Fixes a TODO referencing the ancient issue ziglang#305.
The-King-of-Toasters
added a commit
to The-King-of-Toasters/zig
that referenced
this issue
Mar 16, 2024
Fixes a TODO referencing the ancient issue ziglang#305.
RossComputerGuy
pushed a commit
to ExpidusOS-archive/zig
that referenced
this issue
Mar 20, 2024
Fixes a TODO referencing the ancient issue ziglang#305.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
accepted
This proposal is planned.
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Example:
So here we set the tag type of
VGAColor
tou4
. Then we set the tag values for Black, White, and Blue. This would also work even if an enum value had a payload:The tag type has to support equality and comparison operators, and there's no operator overloading. So it pretty much limits it to integers.
Delete the ability to explicit cast enum tags to any integer and replace it with the ability to only explicitly cast to the tag type. So if you want to cast an enum tag to an integer, you have to specify the tag type.
The text was updated successfully, but these errors were encountered: