3 ms·
> 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 syntacti
by kps 4y ago
> 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.
- rom-antics 4y agoiirc there was a proposal to have Zig used `funcptr.()` syntax (with a dot) for indirect calls, but it was rejected.
- cultureswitch 4y agoInteresting. 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.