{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreicrcmbilk6eff3g7nhzfeutke337j26kbver4syou4tqefy5b2rei",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mfkko6zbdan2"
  },
  "path": "/t/pre-pre-rfc-splatting-for-named-arguments-and-function-overloading/24012?page=2#post_32",
  "publishedAt": "2026-02-23T19:18:39.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "Personally, I am quite partial to the approach used by Swift. It’s quite natural to have `.sort()` and `.sort(by: key)` instead of `.sort()` and `.sort_by_key(key)` (Swift’s ability to have distinct callsite names and function body names is also quite nice. Inside the body of `.sort(by: key)` the argument specified with `by` would be called `key`). As methods this isn’t a big difference but `sort(slice, by: key)` is much better than `sort_by_key(slice, key)`.\n\nThis form of non-optional keyword arguments is effectively letting you spread the name of the function between the arguments as best for clarity instead of Rust’s approach (name of the function including all the arguments up front, then unnamed arguments) or Python’s approach of free-form chaos where named arguments can be placed in any order and are syntactically optional. I think the safest form of “overloading” is one where you are only allowed to overload based on the sequence of (possibly empty) names of arguments and not based on types.\n\nI think it would honestly be perfectly suitable to Rust, and since it’s just a fancy flavor of naming functions, it poses no issues for type inference/name resolution/etc. It also comfortably avoids all the bullshit and confusion you get with Python-style named arguments (which is exactly what big arg structs with ..Default::default() give you) where one function can do a variety of similar things with different sets of arguments and you just have to know which combinations of arguments are legal and which are invalid or override each other)",
  "title": "[Pre-pre-RFC] \"splatting\" for named arguments and function overloading"
}