-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
RFC: glib-macros: port attribute parsing to use deluxe crate #970
base: main
Are you sure you want to change the base?
Conversation
b1b0d1b
to
b7eb4cc
Compare
I'm not very convinced by the added value. It makes the code more complicated to understand and adds more proc-macro. |
Yes, this was more needed for the class macro where there are lot of attributes. And the properties macro too if wanted. The idea though is to make it so actually running the proc macro is faster due to the generated parser, but I have not done any benchmarks yet. |
Might be better to have some numbers indeed (not just for this PR). |
btw @ranfdev I will be using this for the class macro and it will be duplicating the same attributes from the properties macro |
b7eb4cc
to
2538062
Compare
@GuillaumeGomez PR now updated with a test to see how porting of one of the wrapper macros to a proc macro would be like |
Some thinking here: the current syntax of the wrapper is really unfortunate. It takes a tuple struct but then it turns it into a normal struct with a single field |
2538062
to
1cbe818
Compare
Also now includes a port of |
1cbe818
to
57bf6db
Compare
The number of changes is impressive. I agree with @GuillaumeGomez that we should evaluate if it's worth porting everything to this macro or not. Mainly because contributing to glib-macros would then require another layer of knowledge: knowing the deluxe macro. For example, if the properties macro gets rewritten, I would need a bit of time to learn deluxe to get comfortable working on the properties macro again. I think it would be better to keep the number of changes to a minimum, so that we can better evaluate the changes introduced by using deluxe. Unless |
These are some changes I have had in the back burner for at least several months now in various states of completeness...
|
An alternative here is to try and bring back some of the utils and techniques from darling/deluxe into glib-macros and implement them manually that way, but my hope is the autogenerated parsers are less error prone |
This is great! I am not familiar with the codebase, so I cannot judge the diff. However, from a user perspective, the |
Working on benchmark here https://github.com/jf2048/glib-macro-bench As I expected |
287aebf
to
0743c00
Compare
0743c00
to
401e76c
Compare
I have this crate that can generate parsers for attributes using a derive macro. It automatically throws errors (and spelling suggestions) on invalid attributes. We can get better errors messages and remove some code this way so here is a port. The tests are passing for me without any changes.
Also made some changes to avoid erroring out early. Before it would just stop on first error, now any compile errors from inner attributes like
#[enum_value(name = ...)]
will be aggregated and included in the final output.Fixes #943