Skip to content
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

Generate aliases #841

Merged
merged 2 commits into from
Apr 5, 2023
Merged

Generate aliases #841

merged 2 commits into from
Apr 5, 2023

Conversation

badcel
Copy link
Member

@badcel badcel commented Mar 31, 2023

  • I agree that my contribution may be licensed either under MIT or any version of LGPL license.

Fixes #757

@badcel badcel force-pushed the generate-aliases branch 9 times, most recently from 607e016 to 6e5e165 Compare April 2, 2023 20:10
@badcel badcel marked this pull request as ready for review April 2, 2023 20:10
@badcel badcel force-pushed the generate-aliases branch 3 times, most recently from e0374e2 to 172642c Compare April 2, 2023 20:36
@badcel
Copy link
Member Author

badcel commented Apr 2, 2023

@cameronwhite Do you have remarks regarding the alias support? You can see it's features in the tests here.

@cameronwhite
Copy link
Contributor

I think that looks fine to me.
I was wondering at first whether it should be more of a "strong typedef" that doesn't allow implicit conversions from the primitive type, if the user should mainly be using the alias type, but the implicit conversions are consistent with the C API. I don't have a strong opinion on this

@badcel
Copy link
Member Author

badcel commented Apr 3, 2023

I made it implicit as constant values can't be of an alias type as creating an instance makes them not constant. So I fall back to their base type for rendering as constant.

The implicit cast allows to use the constant primitive value as a parameter to a function which requires the alias struct.

I wonder if it is to much "magic" as I normally don't like those implicit things happening.

@cameronwhite
Copy link
Contributor

That's a good point about constants, I can see that being necessary for pattern matching if there are any aliased types with constants that are useful to compare against

@badcel badcel force-pushed the generate-aliases branch 2 times, most recently from 0c96a97 to 3ca7e13 Compare April 3, 2023 19:26
@badcel
Copy link
Member Author

badcel commented Apr 4, 2023

There is currently only GST_CLOCK_TIME_NONE.

It seems to work in a switch statement but not a switch expression. Perhaps there is a way forward to solve this. Will test.

@badcel badcel force-pushed the generate-aliases branch 2 times, most recently from 4a70a41 to 0978bcc Compare April 4, 2023 15:28
@badcel badcel force-pushed the generate-aliases branch from 0978bcc to 83a69f2 Compare April 4, 2023 20:02
@badcel badcel force-pushed the generate-aliases branch from 83a69f2 to 31d750a Compare April 5, 2023 12:58
@badcel badcel merged commit a71770d into main Apr 5, 2023
@badcel badcel deleted the generate-aliases branch April 5, 2023 13:07
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.

Consider removal of GObject.Type
2 participants