That hits the point. Zig might, due to not yet reaching version 1.0, be accustomed to the fact that updates to the standard library are mostly breaking changes, and therefore less consideration is given to cases of ‘implementation changes without API changes.’ But this indeed makes sense, because when an API changes, the API itself can be marked as deprecated or obsolete, and retaining these deprecated APIs has little impact on scenarios that don’t use them. However, fields are different; a deprecated field can never be retained. Therefore, if one relies on accessing a field, any changes to the field itself during a library update will inevitably render the old code unusable.
In practice, documentation can be relied upon to describe which fields are stable. In addition, test cases can help understand the correct ways to directly access certain fields.As for the current Zig implementation, we have to embrace documentation. It does more than expected, including input constraints for various parameters that rely on the documentation.
But don’t get me wrong, I actually don’t like this. In my mind, documentation is the easiest thing to become outdated, much more so than the actual API, because when the implementation changes, the documentation doesn’t appear to have any immediate impact. Soon, the documentation accumulates a large amount of outdated information.