-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Variadic Source Generator #166
Conversation
Sounds great! One question tho. Is the same output produced? E.g. many source generated overloads make use of the batched operations e.g. : |
Yep, I'm using the original sourcegen as a guide! Variable names might be different but the code should semantically be the same. Cool, I'll convert everything over then. |
Is there a reason for the change of variable names from t0, t1 etc to Component__T0, Component__T1? |
This is because it's much easier to have a common variable/parameter format for the variadic source generator to hook into. We could switch back to t0Component etc but it would more effort and be more finicky, since it doesn't map directly to the type.
There are only two situations which require user intervention here:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally had some time to look at the pr ^^
Looks good so far, kinda confusing since its source-gen. So i requested a few changes for clarity. Also... do we really require those doubled .Has e.g. methods? We could make it so that we just mark the single generics with variadic?
OK, fixed what I could til I get more info from genaray, and did another documentation pass. Thanks for the feedback, both of you! |
Alright the previous concerns were fixed ^^ |
Closing this for now since it's gone stale, and I don't have time to keep an eye on it -- if at some point you want to integrate this, feel free to re-open! |
Currently, the Arch source-generation is pretty clunky. There's no compilation validation at all, making edits on the codebase hell.
This PR introduces a "variadic source generator", similar to variadic templates in C++. It makes variadic generics.. well, generic!
For example, you can specify a variadic like so...
This signature will be the very first variadic generated, so it'll generate
<T0, T1, T3>
onwards up to<T0 ... T24>
(total count 25).Additional features can be added through comments. For example, this directive:
Will produce:
Using this directive:
Will produce:
It additionally puts each variadic in separate files like this:
This enables easier debugging instead of one monolithic file.