-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add record!
macro for making labelled HLlists
#126
Comments
This looks like the perfect use case for function procedural macros, which IIRC are being stabilized in this release cycle? |
I may have misinterpreted; I thought the identifiers were interpreted as the field names, but I now see it's possible that they were already assumed to exist as type aliases. In the latter case, this macro is already possible with Having Record! {
age: u32, // uses the existing type `age`
}
Record! {
"age": u32, // generates a label type
} (But more is not always better) |
The automatic generation of the label type does seem like a win in terms of ergonomics and let's you get away with being more ad-hoc "on the flow". Perhaps for disambiguation, a leading sigil would be clearer, e.g.: Record! {
!age: u32, // generates a label type
} Bikeshed on the sigil of course, for example: On the other hand, a benefit of macro_rules is that it can be in the same crate... |
https://github.com/lloydmeta/frunk/pull/124/files/7e4bc32eeac38288f9cedf60c5e5ab68c54e3f30#r220041930
Proposal
The text was updated successfully, but these errors were encountered: