3 ms·
It's not just different. This syntax is less arbitrary than C's. It draws a syntactic parallel between accessing a single member and accessing "all members". (
by sudahtigabulan 2y ago
It's not just different.
This syntax is less arbitrary than C's. It draws a syntactic parallel between accessing a single member and accessing "all members". (by using pattern-matching-like syntax)
It makes the language more consistent and one's mental model of it smaller. (Even though I doubt that patterns other than the Kleene star would work)
A parallel with files:
cp dir/a dir/b dir/c /other/dir
In Zig you can
cp dir/* /other/dir
In C:
cp *dir /other/dir
- spacedcowboy 2y agoI don't actually agree that it makes the mental model smaller. I see something that is just different from what I expect, is cognitively jarring, interrupts the flow of what I'm doing, and forces me to focus on something I shouldn't need to. But it seems like I'm in the minority, so maybe it's just "old man shouts at clouds", I'll just ignore the language and move on :)