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

PlFrame should be non-copyable #2

Open
vmatare opened this issue May 15, 2016 · 1 comment
Open

PlFrame should be non-copyable #2

vmatare opened this issue May 15, 2016 · 1 comment

Comments

@vmatare
Copy link
Contributor

vmatare commented May 15, 2016

Rationale: If a PlFrame object is passed by value, the implicity generated copy constructor creates another PlFrame that holds the same fid value. We now have two references to the same prolog frame with different lifetimes, and when one is destroyed, the fid attribute of the other points to a frame that has already been closed. Correct me if I'm wrong, but that does not seem be intended.

@vmatare vmatare changed the title PlFrame should be non-copyable PlFrame should be non-copyable May 15, 2016
@kamahen
Copy link
Member

kamahen commented Jul 10, 2022

I've added "delete"d definitions for assignment and copy constructor. I've also gone through the other classes and made explicit whether they are copyable or not.
In general, I've disabled the assignment operators because of conflict with the definition of unification; and I've also removed the assignment for PlTerm, which implemented unification because it (a) could be confusing, (b) made it easy to leave off the test for success, and (c) has different semantics than what people expect with assignment (returning a bool instead of a reference to the left hand side).
These changes should be available within a few days.

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