packages-cpp icon indicating copy to clipboard operation
packages-cpp copied to clipboard

PlFrame should be non-copyable

Open vmatare opened this issue 9 years ago • 1 comments

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 avatar May 15 '16 17:05 vmatare

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.

kamahen avatar Jul 10 '22 17:07 kamahen