On Thu, Jul 18, 2013 at 3:06 PM, Corey Richardson <[email protected]> wrote:
> On Thu, Jul 18, 2013 at 2:15 PM, Brian Anderson <[email protected]> wrote:
>>
>> I disagree with the premise. There are any number of valid traits that
>> library authors can forget to implement. Clone isn't special here.
>>
>
> Thinking about it more over lunch I came to the same conclusion: we
> need a generic way to automatically derive trait implementations for
> types which are eligible. #[deriving(Eq, Ord, TotalOrd, TotalEq,
> IterBytes, Clone)] should be the default. Almost every type wants
> them, and your type can be crippled without them.
>
> Of course, this comes with the peril that someone will not override
> the derived implementation and their code will be incorrect as a
> result.

You don't want it on every type though. Most types are going to be
private to a module, and should only have the minimal implementations
required for their usage. As always, a public API takes careful
thought and deriving the appropriate traits should be part of that, as
it is in Haskell.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to