About reassigning self in classes

Thanks for providing those links! I've read them through and they are mostly about the problem as formulated in the forked thread, and while they provide answers to the problem from that perspective, they don't quite answer the specific questions of this thread, namely:

Given the program in the OP (which demonstrates that it is possible to reassign self in classes, and that the way it is done is such that it might happen accidentally):


I've quoted the parts of the linked discussions that comes closest to answering these questions here:


So what I'm saying is that after reading and understanding the above (and the other parts of the linked discussions) I've yet to see the rationale for the seemingly inconsistent behavior demonstrated by the program in the OP. That is:
Why does Swift allow a default implementation of a protocol to reassign self of a class from under our feet (while actively preventing us from doing it explicitly within the class)?

2 Likes