News for hackers. Stuff that matters.
Re:What Makes Code Hard to Read: Visual Patterns of Complexi... by wegfawefgawefg on Tuesday March 11, 2025 @08:25PM (#43338653)
everytime i see this i just would prefer a variadic function lol
Re:What Makes Code Hard to Read: Visual Patterns of Complexi... by vitus on Tuesday March 11, 2025 @09:07PM (#43338934)
If your language supports named arguments, sure, but that's not always a given.
Re:What Makes Code Hard to Read: Visual Patterns of Complexi... by wegfawefgawefg on Friday March 14, 2025 @08:02PM (#43368604)
i dont buy it. this pattern was common in rust and then fell out of favor.

in c or go if you dont like variadics just pass in a params struct.

its just a fad.

Re:What Makes Code Hard to Read: Visual Patterns of Complexi... by vitus on Sunday March 16, 2025 @12:32AM (#43376945)
> in c or go if you dont like variadics just pass in a params struct.

Which, again, is fine if your language supports named args for your params struct.

C++ didn't have this until C++20, despite C having it for decades prior.

Java still doesn't have this.

If your language doesn't have named args or designated initializers or whatever it calls them, then what, perform your function calls with argument comments of the form f(/*foo=*/1, /*bar=*/2, /*baz=*/true)? That's error-prone even in the best-case scenario.