Notes
With regards to source generation, we want to consider a few things.
Namespace Pollution
There are a wide swathe of APIs and structures available, especially in a 'global' context.
Personally, it is favourable to make pollution of your global namespace opt-in rather than by default.
OS Compatabilities
When presenting API that have OS specificity, we want to consider how to provide the API in a type safe manner, which is resolved at Compile Time.
Since the source is being entirely generated, I don't see the harm in opting for the third method.
Enums/Unions
When it comes to generating, naming, and referencing Enums, I prefer things to have a common access point.
A methodology I like, which is available to us as we are source generating, is to have an AutoOpen
Enums
module. All Enums are contained within via modules which follow their access.
For example, if we have an Enum for the Renderer Class BrowserWindow for the set-rect method, we would locate this in Enums.BrowserWindow.SetRect.#NameOfParameter#
.
The primary reason I prefer this, is because you can explore unions/enums within your editor using intellisense, without other classes/types polluting the suggestions.