Re: [rust-dev] Conflicting implementations of a trait

2014-08-03 Thread Lionel Parreaux
Hi, I just stumbled upon your message, and that reminded me of something I had thought about. In Scala, type classes are interfaces, and type class instances are types implementing these interfaces. But the receiver type (the self type, the type of the instance), only serves to define operations,

[rust-dev] Conflicting implementations of a trait

2014-07-22 Thread Allen Welkie
Can there be two simultaneous implementations of a generic trait? I ask because I want to extend the Complex class to allow for multiplication by scalars, so that you can use a * b where a and b can be either scalars or Complex. The Complex struct already has an implementation of the Mul trait. I

Re: [rust-dev] Conflicting implementations of a trait

2014-07-22 Thread Corey Richardson
Not right now. Extending the language to allow this is the subject of RFC 24: https://github.com/rust-lang/rfcs/blob/master/active/0024-traits.md On Tue, Jul 22, 2014 at 9:50 AM, Allen Welkie allen.wel...@gmail.com wrote: Can there be two simultaneous implementations of a generic trait? I ask

Re: [rust-dev] Conflicting implementations of a trait

2014-07-22 Thread Sebastian Gesemann
Am 22.07.2014 18:50, schrieb Allen Welkie: Can there be two simultaneous implementations of a generic trait? I ask because I want to extend the Complex class to allow for multiplication by scalars, so that you can use a * b where a and b can be either scalars or Complex. [snip] Something