-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
Copy values have special copy semantics, when they're moved away, the old place still have valid value alive. A lot of times this is not people want. For example, it's very easy to typo and wrongly use some temporary values after they have been sent away with assignment.
If possible, i'd propose a move expression:
`move` `(` expr `)`The parenthesis are for avoiding the ambiguity with move closures.
Example:
let a = 42;
x.a = move(a);
double(&mut x.a);
dbg!(a); // compile errorAlternatives:
unlet a;a.movelet a = 42 in { ... };
kennytm, konsumlamm, ptrca, SOF3, WeetHet and 1 more
Metadata
Metadata
Assignees
Labels
No labels