Thinking about it some more and taking into account the feedback here, I don’t think I stand behind my own idea anymore. It is basically emulating private fields in Zig in a convoluted way (that risks hindering compiler optimizations on top) and, as has been mentioned multiple times in the thread, a beginner will make this mistake probably once, and then never again. The planned runtime safety check should be more than enough to help with this. Moreover, an API design like this hides what is actually happening under the hood, which hinders those same beginners’ ability to learn – an antithesis of what I actually think is right.
Thus, I hereby retract this “proposal” (and I’m adding a note to the top of the OP to make it clear) ![]()