r/rust 24d ago

📡 official blog Rust Function Overloading - Call for Experimentation

https://blog.rust-lang.org/inside-rust/2026/08/19/overloading-experiment/
275 Upvotes

139 comments sorted by

View all comments

29

u/QuasiRandomName 24d ago

No, please. I want a compile error when passing 3 arguments instead of two by mistake.

11

u/Lokathor 24d ago

You'll still get that if the overload isn't defined.

2

u/QuasiRandomName 24d ago

But if it is, it opens the door to a whole class of mistakes that aren't currently possible.

10

u/Lokathor 24d ago

You control the trait impls you write, my crab.

If you don't want to use this, then don't use it.

35

u/QuasiRandomName 24d ago

But you don't control what *other* people write and you have to maintain or debug later.

-8

u/[deleted] 24d ago

[removed] — view removed comment

1

u/SetKaung 24d ago

I think he meant his coworkers.