External Publication
Visit Post

Pre-RFC: Explicit overload sets for mixed-arity function calls

Rust Internals [Unofficial] June 9, 2026
Source

chrefr:

That is just an argument for bad API design of the STL.

Most nontrivial C++ code has many examples like that.

chrefr:

unless you argue that it's not possible to create a good API with overloads.

Indeed it is practically impossible, apart from very simple examples (like sin taking either a float or a double). And in any non-trivial code base you will end up with some of the awful overloads.

chrefr:

Furthermore, even if this is what you argue, in large existing C++ projects that had a large API surface area overloads are just a fact, and coming with new names for every overloaded method is a huge burden. Then you also have to maintain those names when the API changes.

And I think that is not a problem that should burden Rust just to get the FFI a bit nicer. I would rather not have the FFI with C++ at all if that is a requirement. Overloading as done in C++ is just that bad.

And I write that as someone who writes C++ and Rust for work (but currently not linked into the same binary, the different services talk over gRPC). FFI would be nice. But not at the cost of overloading in Rust.

Discussion in the ATmosphere

Loading comments...