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

Consider using darling for proc macro parsing #19

Closed
greyblake opened this issue Feb 21, 2023 · 1 comment
Closed

Consider using darling for proc macro parsing #19

greyblake opened this issue Feb 21, 2023 · 1 comment

Comments

@greyblake
Copy link
Owner

greyblake commented Feb 21, 2023

See: https://github.com/TedDriggs/darling

It's used in many projects already and if it's flexible enough, it can simplify proc macro parsing a lot.

The list of similar libs for a reference:

@greyblake
Copy link
Owner Author

I gave an attempt to darling. The result can be seen at the moment in branch v031-experiment-darling
The library is very cool and make some things simpler.
However, in case of nutype, I had to face number of small issues that required workarounds.
There were some tiny things, (e.g. inability to handle i128/u128 which was easily addressed with a tiny PR.

There were a bit weird things like Expr does not parse str lit correctly: TedDriggs/darling#229

There were bigger things, like inability to parse negative integer.

After all it feels like the effort is not worth it. There are too much work around and too many intermediate types.
So I've decided to just parse things with syn::parse. It results into a way more straight forward code and should be at least a few times faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant