Though the problem of the style is parent object must be valid as long as it’s interface is being used, which is easy to break if you “accidentally” allocated object on stack in some factory and returns pointer to it’s inner-interface, so heap allocation must be used to avoid that.
There’s a nice general purpose interface lib worth checking out: github.com/alexnask/interface.zig
EDIT: Turns out the zig-dev team have noticed the issue, a proposal has been accepted:
Yes you are right about having to be careful. Thanks for the link!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
For further actions, you may consider blocking this person and/or reporting abuse
Take off every Zig!