You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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:
and you can call it with:
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?
The text was updated successfully, but these errors were encountered: