Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Deprecate constants for the Win32 enumerations #832

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

halildurmus
Copy link
Owner

@halildurmus halildurmus commented Mar 21, 2024

Part of #819

Previously, these constants were manually added as top-level constants. However, with #819, it's no longer feasible to expose all Win32 enumerations this way due to name conflicts. Therefore, to solve this problem, all Win32 enumerations need to be placed under a namespace. Win32 enumerations are also defined this way in the metadata.

For example:

Screenshot 2024-03-21 160312

I think extension types are a great choice for organizing the enumerations. They act as a namespace and incur zero-cost. I also have plans to update the parameter types of Win32 functions that accept enumerations to use the corresponding extension type. This adjustment will give users clarity on the acceptable values ​​they can pass, as opposed to the current generic int representation.

To facilitate this transition, this PR introduces Win32 enums as extension types based on int while also deprecating top-level constants. Additionally, this PR includes data-driven fixes to automate the migration process. Tests for deprecated constants have also been added to ensure their values ​​are the same as newly added constants. Thanks to these tests, I also fixed some constants that had incorrect values.

@halildurmus halildurmus marked this pull request as ready for review March 21, 2024 12:58
@halildurmus halildurmus enabled auto-merge (squash) March 21, 2024 12:58
@halildurmus halildurmus merged commit 810926b into main Mar 21, 2024
6 checks passed
@halildurmus halildurmus deleted the deprecate-constants branch March 21, 2024 19:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants