On named arguments
Posted: Sat Feb 21, 2026 12:00 pm
I've just noticed an interesting usage pattern that has emerged for me over time wrt named arguments
I generally really like named arguments, so to me whether they belong or not in a language is not up for discussion. I couldn't care less about the issues frequently brought up, like "names become part of the public API" (so what? you're breaking your public API all the time anyway with named arguments or not) and my favourite non-argument: "I have python-induced trauma from libraries that abused named arguments" (you're not special we're all traumatized by python, your trauma is not language design).
Anyway, one place where named arguments shine is when functions take primitive parameters! It's not mandatory to set the name of the argument (well, depends on the language), but when a function takes a bunch of booleans, I find it almost always pays off in terms of readability to specify the names those parameters.
Maybe this is why people love those inlay hints so much? To me they're just distrtacting because having them *everywhere* means they become part of the background noise whereas placing them with intent where I think it adds value sounds like a way to get nicer and more readable code.
This is the bit of code that inspired this:
It's obvious to me, and thus noisy, to know that the first two parameters are the "ui" and the game's "difficulty", which presumably the objectives hud will care about. Those are also well-typed things that would be hard to mess up, so I can skip the name and it's nice and succint.
For the third argument, though, it makes all the difference because it makes me go from being confused: "Why the heck does the objectives panel want to know about the pause menu??" to understanding a bit more about the system: "Ah, the objectives panel is only interactable when the pause menu is shown!".
I generally really like named arguments, so to me whether they belong or not in a language is not up for discussion. I couldn't care less about the issues frequently brought up, like "names become part of the public API" (so what? you're breaking your public API all the time anyway with named arguments or not) and my favourite non-argument: "I have python-induced trauma from libraries that abused named arguments" (you're not special we're all traumatized by python, your trauma is not language design).
Anyway, one place where named arguments shine is when functions take primitive parameters! It's not mandatory to set the name of the argument (well, depends on the language), but when a function takes a bunch of booleans, I find it almost always pays off in terms of readability to specify the names those parameters.
Maybe this is why people love those inlay hints so much? To me they're just distrtacting because having them *everywhere* means they become part of the background noise whereas placing them with intent where I think it adds value sounds like a way to get nicer and more readable code.
This is the bit of code that inspired this:
It's obvious to me, and thus noisy, to know that the first two parameters are the "ui" and the game's "difficulty", which presumably the objectives hud will care about. Those are also well-typed things that would be hard to mess up, so I can skip the name and it's nice and succint.
For the third argument, though, it makes all the difference because it makes me go from being confused: "Why the heck does the objectives panel want to know about the pause menu??" to understanding a bit more about the system: "Ah, the objectives panel is only interactable when the pause menu is shown!".