Skip to content

Fix subclass overrides and initialization order #309

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

Open
wants to merge 6 commits into
base: v1
Choose a base branch
from

Conversation

Joseph-Edwards
Copy link
Collaborator

@Joseph-Edwards Joseph-Edwards commented Aug 1, 2025

This PR does two things:

  1. Refactor the sims binding code so that subclasses do not incorrectly override (rather than overload) certain functions (addressing Some classes incorrectly attempt to overload functions in their base class #305) ; and
  2. Change the order in which things are initialized. This reduces the amount of C++ style code that appears in the error messages, amongst other places.

Comment on lines +565 to +571
// TODO(0): Uncomment or remove
// thing.def(py::init<Thing const&>(),
// fmt::format(R"pbdoc(
// Construct from a {0} object.
// )pbdoc",
// doc_type)
// .c_str());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presently, because of how sims.py is setup, the only 1-parameter constructor for a Sims object takes a presentation. However, in libsemigroups we can construct from other Sims objects. Do we want to be able to do that here too?

If yes, we should uncomment the above function and adjust sims.p. If no, we should delete the above function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this function hasn't always been here. I wrote it for this PR, but then commented it out when I saw how sims.py was setup.

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

Successfully merging this pull request may close these issues.

1 participant