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

Rewrite for 1.0 #39

Open
Renmusxd opened this issue Nov 5, 2021 · 4 comments
Open

Rewrite for 1.0 #39

Renmusxd opened this issue Nov 5, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@Renmusxd
Copy link
Owner

Renmusxd commented Nov 5, 2021

Much of this library isn't idiomatic rust - nor is it really well written to be honest with myself.
The numerics under the hood are fine and fairly well optimized, the issue is that the UnitaryBuilder trait and pipeline constructor heavily uses dynamic dispatch. Switching over to generics and traits would allow for much more flexibility from a type system perspective.
This would require a large reorganization, and much of the responsibility of the classes would need to be moved around.

@Renmusxd Renmusxd added the enhancement New feature or request label Nov 5, 2021
@Renmusxd
Copy link
Owner Author

91e98a9 is the first stable large reorganization matching all the above criteria. A few modules have been dropped for now (unfortunately including the some macro support). Slowly working on reintroducing these. the program and wrap_fn/invert_fn macros really need to be rewritten as procedural macros now to properly deal with generics and the stronger type constraints introduced by no longer using the dyn keyword.

@Renmusxd
Copy link
Owner Author

After some thought it seems the program! and wrap! / invert_fn! macros need to be significantly rethought. I believe with the strong types in the rewrite (such as no use of dyn) they can't be rewritten as macro_rules! without some significant complexity.

I am slowly learning how to write procedural macros to add these back in, since they are a cornerstone of QOL for this project.

@Renmusxd
Copy link
Owner Author

Renmusxd commented Jun 3, 2022

1ab3a11 is the bulk of the program! rewrite, it is now a procedural macro living in a package adjacent to the core qip code. It can be enabled via the "macros" feature. Some of the previously supported modules are gated by this now since they make heavy use of program!

The syntax changed a bit (mostly just additional semicolons and now longer requiring vertical bars where we would have preferred parens or square brackets), I'll update docs soon.

@Renmusxd
Copy link
Owner Author

Renmusxd commented Jun 4, 2022

Docs updated in f9940ca - while making the invert macro found a bug in some code from 91e98a9 for making subcircuits. This (further) tells me that I need to work on reintroducing the unit tests before working on any new 1.0 features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant