Discussion: A potential solution to the anytype problem (opens in new tab)
Polymorphism is hated as much as it’s loved, but one thing is for sure: it’s not going anywhere, and if zig wants to spread, it should probably be possible in some way. However, polymorphism almost always adds implicit behavior and “magic”, which is strictly against the zig philosophy. For this reason, polymorphism in zig relies almost entirely on the anytype keyword, which does not provide any way to explicitly define what members the type is required to include. Here’s an example: const pri...
Read the original article