# Zig 0.15.1 reader/writer: Don't make copies of @fieldParentPtr()-based interfaces

**URL:** <https://ziggit.dev/t/zig-0-15-1-reader-writer-dont-make-copies-of-fieldparentptr-based-interfaces/11719>\
**Category:** Explain\
**Created:** [August 28, 2025, 6:02am UTC](https://ziggit.dev/t/zig-0-15-1-reader-writer-dont-make-copies-of-fieldparentptr-based-interfaces/11719 "2025-08-28T06:02:42Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![mg979](https://ziggit.dev/letter_avatar_proxy/v4/letter/m/3e96dc/32.png) [@mg979](https://ziggit.dev/u/mg979)\
**Post date:** [August 28, 2025, 6:03pm UTC](https://ziggit.dev/t/zig-0-15-1-reader-writer-dont-make-copies-of-fieldparentptr-based-interfaces/11719/9 "2025-08-28T18:03:08Z")

</div>

Forgive me if it’s not pertinent, but wouldn’t it be simpler to consider it a problem of the standard library, rather than of the language?

If you use @fieldParentPtr yourself, you know where the troubles lie, but if it’s in std, you have to read std, which also changes across versions.

By reading [I'm too dumb for Zig's new IO interface](https://ziggit.dev/t/im-too-dumb-for-zigs-new-io-interface/11645), I noticed that in `std.net` there is actually a `interface` method

```zig
            pub fn interface(r: *Reader) *Io.Reader {
                return &r.interface_state;
            }

```

By introducing the practice of getting interfaces by methods and not directly you’d bypass the problem.

Moreover, if std exposes methods to access the interfaces, then the implementation could be changed without breaking existing code, because the methods could be modified to adapt to the changes.

So in `std.fs.File`, `interface` could become `io_reader`, and the method would be

```zig
    pub fn interface(r: *Reader) *std.Io.Reader {
        return &r.io_reader;
    }

```

`std` wouldn’t even need to change its code, since these methods would be made for the users. Honestly I think it’s a bit hard to require everybody to study std to avoid pitfalls.

It’s basically what I suggested [here](https://ziggit.dev/t/0-15-1-reader-writer/11614/20) without the pseudo-private field.

Again, forgive me if not pertinent.

---

_[View the full topic](https://ziggit.dev/t/zig-0-15-1-reader-writer-dont-make-copies-of-fieldparentptr-based-interfaces/11719)._
