Skip to content

Fixing incorrect enum information and add alternatives #73

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

edwood-grant
Copy link

The current page https://docs.vala.dev/developer-guides/bindings/writing-a-vapi-manually/04-00-recognizing-vala-semantics-in-c-code/04-02-enums-and-flags.html

Indicates that an enum can inherit.
According to a recent conversation issue in the Vala GitLab, this is incorrect, and enum inheritance is not a thing:

https://gitlab.gnome.org/GNOME/vala/-/issues/1595

So I removed this set of code and example, and instead added a valid alternative (just creating a separate enum and casting to the original can work).

I also added another enum example to deal with aliases, which when you invoke a to_string () method can cause duplicate case compiler errors in C, which can be solved via public const values. (Explained here https://gitlab.gnome.org/GNOME/vala/-/issues/1596)

Hopefully this is a good addition to the docs :).

Copy link
Contributor

@lw64 lw64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the nice expansion! :D

@edwood-grant edwood-grant requested a review from lw64 March 17, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants