Better HN
topnewbestaskshowjobs
Log inSign up

leagreeer

4 karma · joined Jul 19, 2025 (1y ago) · 3 submissions

Submissions

comment 1y ago · link · parent

In every different zig project you have to read the source code to see how their specific ad-hoc interface scheme works. Case in point - this article uses a method `pub fn implBy(impl_obj: anytype)` to connect instances to a vtable. The new zig writer uses a `.interface` data member scheme: https://www.openmymind.net/Zigs-New-Writer/ in addition to understanding when and when not to use it.

comment 1y ago · link · parent

> Do all code bases use the same pattern?

Unfortunately no - it's a complete free for all - which is the problem. Conventions are great to a point but language enforced constructs are better.

comment 1y ago · link · parent

Agreed that native interface support is table stakes for any language now. It would avoid so much boilerplate - nevermind the time wasted examining the code to see what kind of ad-hoc interface any given piece of code is using - and how to retrieve the ridiculous zig vtable data member for each pseudo class instance. It just amounts to useless noise in the code, rather than succinctly stating the intent.