External Publication
Visit Post

Pre-RFC: Function parameter defaults

Rust Internals [Unofficial] February 25, 2026
Source

scottmcm:

To quote what I said last week elsewhere,

I continue to think that we should make using structs for this more ergonomic before considering named function argument proposals. Notably, that avoids all the questions like "and what do the fn traits look like?", plus are more convenient anyway for anyone wanting to wrap such a function, because forwarding "large groups of things" is annoying even with named parameters.

Well, this thread is about function parameter defaults, not named parameters. I posted it independently (a) because an RFC with both would be way too big IMO, and (b) because I think this makes sense as a feature on its own. Please let's not derail this thread with discussions about named parameters.

edit: Actually, how function param defaults could [not] work together with proposed improvements to "options structs" or whatever you want to call it, would be very much on-topic. But you seem to assert that function param defaults only make sense in combination with named parameters, and I think you should make a case to why, rather than just asserting it.

scottmcm:

There have been loads of conversations like this before.

I know, and with more time I would have collected them all and summarized them (along filling out some more of the RFC template), and posted this as an actual RFC instead of just a Pre-RFC.

scottmcm:

I suggest you write the rationale and such first, not the "here's the solution I propose".

The text above has a Motivation section, so I don't understand this criticism.

Discussion in the ATmosphere

Loading comments...