Zig NEWS

Discussion on: Faster Interface Style

Collapse
 
stacktracer profile image
Mike Hogye

Does anyone else find the new style easier to reason about?

For me the new style is a much better fit for my mental model of interfaces and impls. Not entirely sure why. Somehow the @fieldParentPtr pattern never felt intuitive, even after I'd worked with it a little bit.

Collapse
 
david_vanderson profile image
David Vanderson

I agree. It feels more like a straight-up function pointer. Also it's easier for me to understand how you can separate the interface struct, copy and store it around in different data structures. As long as the impl struct stays put!