borgo
borgo copied to clipboard
"multiple 'self' symbols"
While working in Rust, I noticed that one way to avoid expensive refactors is to defer the decision "which struct/trait should have this method" as long as possible. It allows avoiding "oh, you already took struct X as &mut, you can't now take one of it's field as &" errors.
So I figured, this would actually be a great language feature. Imagine you have function:
fn function(x : &mut X, y: &Y) -> Z {
}
and you can call it with:
let mut x = X::new();
let y = Y::new();
x.function(y)
//or
(x, y).function();
Then we can discuss if you want to allow reordering, renaming etc, but the gist of it is - let's just stop treating "self" as a magic special argument.
What do you think?