Skip to content
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

Concerns about rolling your own derive macro framework #518

Closed
coolreader18 opened this issue Mar 7, 2022 · 1 comment
Closed

Concerns about rolling your own derive macro framework #518

coolreader18 opened this issue Mar 7, 2022 · 1 comment

Comments

@coolreader18
Copy link

coolreader18 commented Mar 7, 2022

I don't know how much my opinion counts here, obviously feel free to discard as it's your project, but to me the zero-dependency-ness of virtue isn't as valuable to me as correctness of the parsing. I'm looking into implementing #511 and reading the source code of virtue because of that and even just glancing I can see some edge cases where parsing would fail (e.g. where Foo: Bar<{ CONST_GENERIC }> would interpret the { } group as the function body. also the case I commented in that issue). It seems like virtue focuses on the happy path of struct Ident { field: Type } but rust's grammar is much more complex than that and is always evolving; syn is well supported/maintained, well-tested in catching edge cases, and keeps up to date with the grammar. virtue is also not very flexible for generation; in order to implement #511 I'm pretty sure I'd have to make some change to virtue which makes contributing harder.

(Oh, also, for syn the cost is lessened if more than one derive macro is in the dependency tree b/c it's so ubiquitous, that's not the case for virtue, it'll always add compile time if I use bincode_derive)

@ZoeyR
Copy link
Collaborator

ZoeyR commented Mar 8, 2022

The reason we switched to virtue instead of using syn is because bincode has a hard MSRV requirement. Bumping MSRV constitutes a major version bump for bincode. This is bad because syn does not have the same policy. So if syn were to up their MSRV beyond the bincode 2 MSRV we would have to stop using it anyways. I know that syn is battle tested but it unfortunately does not suit bincodes needs.

@ZoeyR ZoeyR closed this as completed Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants