-
Notifications
You must be signed in to change notification settings - Fork 30
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
Refactor the derive crate #63
Comments
You might be thinking about using the https://crates.io/crates/synstructure crate for the refactoring of the derive macros. |
I did experiment with that and decided (at the time) that it wasn't suitable because it was more aimed at generating derived impls for type instances, and we have a static method so no instance to match against. However I could be wrong and it is certainly worth revisiting. |
It is a very flexible crate, yet also introduces further complexity because you have to understand how it is meant to be used. So please take my thoughts as reminder that this crate exists and might do a good job here, not as suggestion. ;) |
I will definitely look again at it - I do like what I have seen where you have used it. |
As raised in #61 (review), it is less than ideal we have to pass around the crate names to all the functions.
Originally the proc macro was very small so could justify being a few functions, but now it is becoming unwieldy and there is the above mentioned problem of shared global state.
One approach would be to separate the process into 2 steps
parse -> Intermediate Representation -> expand
which is a common pattern in proc macros.The text was updated successfully, but these errors were encountered: