Are there any plans to add syntax sugar for interacting with vtables?
Re:Zig 0.16.0 Release Notes
by metaltyphoon on Tuesday April 14, 2026 @09:21PM
(#47773530)
Sadly no, as fas as I'm aware. I can't think of creating vtables manually every time I need to create interfaces, I guess Zig is not for me.
Re:Zig 0.16.0 Release Notes
by slopinthebag on Tuesday April 14, 2026 @11:53PM
(#47774517)
Yeah I don't understand why a language cannot automate something that routine and boilerplate-y.
Oh well, people like it so I won't judge, I'm happy we have choices for what languages we use. Just wish people would choose safe ones :/
Wish we could bribe Andrew Kelley to add a built-in for this. There are only a couple of regular ways that everyone creates these vtables. Might as well just standardize it.
Also, Zig's tagged unions (enums with payloads in Rust) are really ergonomic and often what you want instead of interfaces. Alot of languages that use interfaces simply don't expose a good way of doing it so everyone reaches for interfaces by default. But if you don't need an actual interface then this way you don't even have to pay the cost of runtime dynamic dispatch.