Trait in zig

I suggest reading through the many, many, many discussions about comptime zero-cost interfaces (essentially what traits are). You will get a good idea for how zig allows for them. There is also this post by Andrew in regards to a proposal for comptime interfaces:

I’m not saying there won’t be interfaces of any kind, ever, but there are no current plans for adding them, and this proposal is incomplete. It does not propose anything specific.

I suggest if you want to use zig, you accept the fact that it may never gain an interface-like feature, and also trust the core team to add it in a satisfactory manner if it does get added at all.

Which i found on linked to on this thread


I’m not sure i see a reason to keep this thread open anymore, as it’s usefulness is in compiling the above list of links for others to find and dive into before broaching this subject again.

11 Likes