Re: [rust-dev] instantiating parameterized impls

2013-09-06 Thread Niko Matsakis
Hi David, My current thinking on the matter is that eventually, I would like to take advantage of the coherence rules to permit a program like this. Coherence means that given a specific type T and trait U, we can always tell whether T implements U. This implies that we could do the check as you

[rust-dev] instantiating parameterized impls

2013-09-05 Thread David Renshaw
Hi, When I try to compile the below program, why do I get a conflicting implementations error? I do not define any implementations of Bar, so the parameterized impl of Foo should never get instantiated, right? --- trait Foo { fn foo() - Self; } trait Bar : std::num::Zero {

Re: [rust-dev] instantiating parameterized impls

2013-09-05 Thread Tim Chevalier
On Thu, Sep 5, 2013 at 9:29 AM, David Renshaw dwrens...@gmail.com wrote: Hi, When I try to compile the below program, why do I get a conflicting implementations error? I do not define any implementations of Bar, so the parameterized impl of Foo should never get instantiated, right?

Re: [rust-dev] instantiating parameterized impls

2013-09-05 Thread Steven Blenkinsop
On Thu, Sep 5, 2013 at 3:36 PM, Tim Chevalier catamorph...@gmail.comwrote: The reason is that there is no guarantee that you will never use this code in a context where another module defines an impl of Bar for u16. In that scenario, you would have two different impls of Foo for u16, and no