
Zig doesn't allow "private" data members of a struct. Here's Andrew's reasoning behind it: "The idea of private fields and getter/setter methods was popularized by Java, but it is an anti-pattern. Fields are there; they exist. They are the data that underpins any abstraction. My recommendation is to name fields carefully and leave them as part of the public API, carefully documenting what they do." I guess he is against abstracting the internal representation from public. I have 2 questions here: 1. how do you change your implementation without breaking public APIs ? 2. How do you ensure that all data structure invariants are maintained by user code since all your representation is now public ? Thoughts ? (link to Andrew's thoughts: 👇)




























