On 11/30/11 3:08 AM, Marijn Haverbeke wrote:
https://github.com/graydon/rust/wiki/Interface-and-Implementation-Proposal
As I mentioned on IRC, I think it might be useful to have some syntax to
denote the mode of the receiver. Almost all the time you want it to be
`&&`, but for the `sendable` interface, in particular, a move mode is
more appropriate. I am not sure what this syntax ought to be but here
are some possibilities that come to mind.
Prefix the method declaration:
iface sendable {
-fn send(c: chan<_>);
}
After the method declaration (à la C++):
iface sendable {
fn send(c: chan<_>) -;
}
First argument that consists of just a mode:
iface sendable {
fn send(-, c: chan<_>);
}
self keyword with no type as first argument:
iface sendable {
fn send(-self, c: chan<_>);
}
However, it occurs to me that we could just ignore this issue if we want
to make sendable more of a marker interface (i.e., it would be an
interface with no methods that is not explicitly implementable). In
that case, sending would be a function like:
fn send<T:sendable>(chan: chan<T>, -msg: T);
Niko
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev