News for hackers. Stuff that matters.
Re:Why Zig over C for Systems Programming by raincole on Friday November 13, 2026 @11:42AM (#50486063)
I honestly don't think total = a.sum() is any less explicit than for (size_t i = 0; i <= n; i++) total += a[i]. If anything, a.sum() is more explicit as at least it expresses the programmer's intention explicitly. The loop is one more layer between the reader and the writer's intention, nor correctly reflecting how it works on the bare metal. So it's the worse of both worlds.
Re:Why Zig over C for Systems Programming by bmandale on Friday November 13, 2026 @02:27PM (#50488488)
A toy example is meant to demonstrate a principle. Toy examples often have alternative ways they can be written, but the concept they are meant to demonstrate requires the whole machinery being employed. Furthermore, how do you think .sum is implemented?