News for hackers. Stuff that matters.
Re:Zig's dot star syntax (value.*) by sudahtigabulan on Saturday March 08, 2025 @08:13PM (#43305214)
It's not just different.

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

  function bleh(a1, a2)
but have to call it like

  a1 a2 bleh
And all newer languages just keep doing it this way, to keep the world a better place.

Or if you have a few files

  cp dir/a dir/b dir/c /other/dir
and to shorten it you have to use

  cp *dir /other/dir
instead of

  cp dir/* /other/dir
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 :)