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

Clean up fj-kernel's iter module #846

Closed
hannobraun opened this issue Jul 20, 2022 · 0 comments · Fixed by #859
Closed

Clean up fj-kernel's iter module #846

hannobraun opened this issue Jul 20, 2022 · 0 comments · Fixed by #859
Labels
topic: core Issues relating to core geometry, operations, algorithms type: development Work to ease development or maintenance, without direct effect on features or bugs

Comments

@hannobraun
Copy link
Owner

The iter module in fj-kernel provides infrastructure to iterate over the objects referenced by another object. This is a critical piece of functionality that is used by the validation infrastructure and other code.

Unfortunately the code in that module is highly redundant. For each object, most method implementations of the ObjectIters look almost exactly the same, because most of those methods just delegate to the corresponding method of the objects being referenced. This results in a lot of code, and a lot of opportunity for subtle errors.

I have two ideas for how to address this, but haven't explored any in depth:

  1. Add an additional method to ObjectIters that returns all objects that the implementing object references as dyn ObjectIters. Then the other methods could get default implementations, based on that method.
  2. Create a proc macro (maybe even in the form of a derive macro?) that implements the trait for all object types. This is probably overkill, unless idea 1 doesn't work out.
@hannobraun hannobraun added type: development Work to ease development or maintenance, without direct effect on features or bugs topic: core Issues relating to core geometry, operations, algorithms labels Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core Issues relating to core geometry, operations, algorithms type: development Work to ease development or maintenance, without direct effect on features or bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant