News for hackers. Stuff that matters.
Re:Low-Level Optimization with Zig by xboxnolifes on Sunday June 08, 2025 @02:51AM (#44215098)
> Most data structures have invariants that must hold for the data structure to behave correctly. If users can directly read and write members, there's no way for the public APIs to guarantee that they will uphold their documented API behaviors.

You can, just not in the "strictly technical" sense. You add a "warranty void if these fields are touched" documentation string.

Re:Low-Level Optimization with Zig by Ygg2 on Sunday June 08, 2025 @12:18PM (#44217875)
That's honestly horrible. It's like finding your job is guaranteed by a pinkie promise, or the equivalent.
Re:Low-Level Optimization with Zig by xboxnolifes on Sunday June 08, 2025 @08:34PM (#44220420)
Most of the world runs on a handshake.
Re:Low-Level Optimization with Zig by Ygg2 on Monday June 09, 2025 @08:22AM (#44223742)
That's not a valid argument. For most of human existence there was cannibalism and/or human sacrifices. This doesn't mean we should go back to it.
Re:Low-Level Optimization with Zig by jcelerier on Monday June 09, 2025 @08:09AM (#44223641)
isn't that the norm in many places on earth?
Re:Low-Level Optimization with Zig by pjmlp on Sunday June 08, 2025 @03:55PM (#44219143)
I prefer liability when devs misuse software with consequences for society infrastructure.
Re:Low-Level Optimization with Zig by xboxnolifes on Sunday June 08, 2025 @08:35PM (#44220426)
A language adding private fields does not add liability.
Re:Low-Level Optimization with Zig by pjmlp on Monday June 09, 2025 @03:58AM (#44222318)
Indeed, misusing the library and causing software faults does, so every stone in the way preventing misuse helps.