{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreifzu3mlax6ug4sdcojrpt4bkog3kghj7rcbcz37axein4dq5xa264",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mfpgx7ljfp32"
},
"path": "/t/pre-rfc-function-parameter-defaults/24011#post_9",
"publishedAt": "2026-02-25T17:05:56.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "quinedot:\n\n> Conceivably if both have defaults, it could be `[fn(bool); 2]` instead.\n\nI assume the compiler would insert the default argument value at the callsite? So at an ABI level there is no such thing as defaulted args (this is how it works in C++/Itanum for example).\n\nIn that case your proposed `fn(bool)` wouldn't work, especially not if the functions have different default args as in your example.\n\nThe other possible lowering would be to insert hidden `Option<...>` around the optional argument and have the callee resolve this. But that will likely be less efficient code gen..\n\n(To design good and performant abstractions you _need_ to consider the target machine code you want, rather than start with lofty high level goals.)",
"title": "Pre-RFC: Function parameter defaults"
}