aurae icon indicating copy to clipboard operation
aurae copied to clipboard

Cells should be immutable

Open krisnova opened this issue 3 years ago • 2 comments

We should not be able to change a cell after it has been created, you must destroy the cell and allocate a new one if you want to change anything about the cell.

krisnova avatar Dec 18 '22 20:12 krisnova

Reviewing the code as it is now, we are almost there. I think we can make this possible in 2 steps:

  1. Create a 3rd variant on CellState called Freed that change the fn free to set that state instead of going back to Unallocated (this prevents Cell.allocate from doing anything in Freed also.
  2. We also want to make sure that we don't accidentally make any of Cell's fields public. We can do this 2 ways: a. Write a comment and hope it gets paid attention too b. Obviously a macro that will override any attempt to set pub or pub(crate) (there may be a crate for this if we want this choice, or it shouldn't be hard to write)

future-highway avatar Dec 19 '22 01:12 future-highway

#180 implements step 1 and step 2a.

future-highway avatar Dec 19 '22 14:12 future-highway

i'm happy with this until we find out it was insufficient and the comment ended up being a sign not a cop.

dmah42 avatar Jun 21 '24 15:06 dmah42