Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

everytime i see this i just would prefer a variadic function lol


If your language supports named arguments, sure, but that's not always a given.


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.


> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: