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

Why are there three implementations of every rule: in rules.py, basicrules.py and editor_actions.py? #249

Open
RazinShaikh opened this issue Jul 2, 2024 · 3 comments

Comments

@RazinShaikh
Copy link
Contributor

These implementation are not always the same and slightly differ from each other but still implement the same core functionality. Is there a reason why we need three versions? Can we unify these?

@jvdwetering
Copy link
Collaborator

rules.py was the original set, and meant for automated application in bulk. I added editor_actions when I was working on the editor, and these were specifically meant to be applied one at a time in an editor context. basicrules.py was added to have some simple functionality that Aleks wanted to use in a course. I think basicrules and editor_actions probably have a lot of overlap since I'm not sure Aleks was aware of the things in editor_actions.
It is probably possible to unify them all. But maybe @akissinger has an opinion on whether basicrules.py should be preserved.

@RazinShaikh
Copy link
Contributor Author

It is probably the best to unify them all. Even if rules are meant to be applied one at a time, the implementation in rules.py should be able to take care of that. The editor_actions methods can be wrapper that simply call the rules.py methods with a single match.

I am trying to fix several rewrites for multigraphs and I am finding that I have to do the same work three times as the methods are all implemented slightly differently. For example, I fixed the bialgebra of basicrules.py but trying to make a similar change doesn't automatically work for editor_actions.py and I need a lot of debugging time to figure out the quirks.

@RazinShaikh
Copy link
Contributor Author

If the purpose of basicrules.py is mainly educational, then isn't it better to move it out of pyzx (or at least deprecate it)? I have noticed that ZXLive arbitrarily uses basicrules.py and rules.py. This can possibly lead to inconsistent behaviour.

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