News for hackers. Stuff that matters.
Re:Zig's Curious Multi-Sequence for Loops by kps on Monday February 27, 2023 @12:14PM (#34959050)
> No hidden control flow.

Off-topic, but… I very much like this idea, but I think Zig shares one wart with languages like C++: it's impossible to tell syntactically whether `f()` is a direct or indirect call. An indirect branch is a conditional branch, where the condition can be arbitrarily far away in space and time, and it's invisible. Dynamic control flow can be tricky to reason about even when you know it's there.

Re:Zig's Curious Multi-Sequence for Loops by rom-antics on Monday February 27, 2023 @12:33PM (#34959329)
iirc there was a proposal to have Zig used `funcptr.()` syntax (with a dot) for indirect calls, but it was rejected.
Re:Zig's Curious Multi-Sequence for Loops by cultureswitch on Tuesday February 28, 2023 @06:35PM (#34976502)
Interesting. To me having "hidden control flow" in your language is the key to create higher level abstractions that are easier to reason about. Same when it comes to "hidden allocation".

That is, in a good language you'd replace an explicit but verbose, error-prone and boilerplate for loop with a declaration of the output of said loop. Either through applying a map function or a python-style list comprehension.