News for hackers. Stuff that matters.
Re:The use of `class` for things that should be simple free ... by mattkrause on Thursday May 28, 2020 @07:11PM (#23344164)
But I don't want that flexibility!

If my state has some invariant, I want to be sure that I can trust it. I don't want to worry that someone will mess with it, breaking the invariant, or accidentally pass in stale state.

If that's all handled automagically by the object, it's out of sight, out of mind. Add in a get_state() and set_state() method if you need it as an escape hatch or for testing.

There are no comments on this comment yet.