News for hackers. Stuff that matters.
Re:Low-Level Optimization with Zig by philwelch on Saturday June 07, 2025 @06:40PM (#44213154)
> I'm not saying it has to be C++ levels of abstraction. But there is a line between interface and implementation that ought to be kept. C headers are nearly perfect for this, letting you hide and rename and recast stuff differently than your .c file has, allowing you to change how stuff works internally.

Can’t you do this in Zig with modules? I thought that’s what the ‘pub’ keyword was for.

You can’t have private fields in a struct that’s publicly available but the same is sort of true in C too. OO style encapsulation isn’t the only way to skin a cat, or to send the cat a message to skin itself as the case may be.

Re:Low-Level Optimization with Zig by 9d on Saturday June 07, 2025 @06:51PM (#44213213)
I don't know Zig so I dunno maybe