Re:Zig's dot star syntax (value.*)
by spacedcowboy on Sunday March 09, 2025 @01:12PM
(#43311204)
I 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 :)
This syntax is less arbitrary than C's. It draws a syntactic parallel between dereferencing a single member vs all members.
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)
Would you like it if you define
but have to call it like And all newer languages just keep doing it this way, to keep the world a better place.Or if you have a few files
and to shorten it you have to use instead of