zig.guide
zig.guide copied to clipboard
How to implement "interface" or "trait" like semantics in Zig
Hi!
Thanks for your great effort on documenting zig.
It would be great to have a section explaining how to implement golang like interfaces or rust like traits in zig. Including examples with / without state (self) and with / without dynamic dispatching.
I just saw this page: https://www.nmichaels.org/zig/interfaces.html
Maybe this can be used for the website.
related issue without conclusive statement yet https://github.com/ziglang/zig/issues/1268
There are still no current plans to introduce a traits-like feature in zig & there hasn't emerged a standard way of doing interfaces like this; closing this for the foreseeable future