Am 16.06.2014 19:36, schrieb Patrick Walton: > On 6/16/14 7:32 AM, Sebastian Gesemann wrote: >> Assuming this RFC is accepted: How would I have to implement Add for a >> custom type T where moving doesn't make much sense and I'd rather use >> immutable references to bind the operands? > > You don't implement Add for those types.
As far as I'm concerned that's anything but a satisfactory answer. I really don't see the point of your RFC. If anything, it seems to make things worse from my perspective. That's why I asked you for some clarifications. Of course, you don't owe me anything. And I hope you don't take this personally. > The purpose of strongly-typed (as opposed to ad-hoc, like C++) traits is > that you can actually tell what the type signature is. I think you misunderstood. Nobody is arguing for "ad-hoc generics" where there is no or just very limited type checking before monomorphization. At least I'm not. I like the fact that Rust checks generics before instantiation. But to be honest, I do find it somewhat annoying that Add<> either forces immutable references or move semantics (depending on whether your RFC is accepted) on to everybody who wants to build new arithmetic types. It's fine with me that you don't want to debate "the entire generic system". I didn't expect you to. I just wanted to share my thoughts on this hoping it to be of some kind of value since I spent much time on how the old C++ concepts design (where structural requirements were also defined in terms of function signatures) interacts with the rest of the language including rvalue references. Just in case people following this thread don't know what I'm talking about: "concepts" is what C++ people call the "type system for types" with which templates are supposed to be constrained (whenever they arrive) -- just like Rust's traits can be used as type bounds in generics. Of course, I realize that Rust is different enough that it can't go down that exact road. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
