[rust-dev] &self/&mut self in traits considered harmful(?)

Tommi rusty.gates at icloud.com
Fri Jun 13 05:39:46 PDT 2014

On 2014-06-13, at 13:14, Tommi <rusty.gates at icloud.com> wrote:

> pub trait Mul<RHS, Result> {
>     fn mul(stable self, rhs: &RHS) -> Result;
> }
> Note: any other syntax for marking `self` as `stable` would be illegal.

Although, I could see this kind of syntax being allowed as well:

pub trait Mul<RHS, Result> {
    fn mul(stable lhs: Self, rhs: &RHS) -> Result;

..and allowing similar syntax for an implementation like:

impl<T: Clone, RHS, Result> Mul<RHS, Result> for T {
    fn mul(stable lhs: T, rhs: &RHS) -> Result { ... }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140613/d7d21f8a/attachment.html>

More information about the Rust-dev mailing list