Hi All,
I've decided to go ahead and take a stab at implemented move semantics for
function arguments. The main reason is that we need move semantics for channel
operations, but we're planning to move these into a library, so we might as
well go ahead and do move semantics now and move channel operations to the
library.
I'm proposing that we leave the default as copy arguments, since this is what
programmers have used for the last 40+ years. For now I'll just add a move
annotation on function signatures. In the future we might add a general move
operator, like C++ has.
We can bikeshed about the best syntax, but for now I'm going to go with the
following:
fn foo(move int x) {
}
I imagine for the most part everything stays the same. Typestate, however, will
recognize that these values are deinitialized after passing to a move-mode
function. The other main issue is moving which function is responsible for
cleanups. Basically, the caller will have to remove the cleanup for any values
passed in as a move-mode argument.
Anyway, I just wanted to let everyone know, and see if anyone has any issues
that need addressed with this.
-Eric
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev