Closed
Description
Now that rust uses the cmp::Eq and cmp::Ord traits for comparisons, there is often lots of error-prone boilerplate required to write impls of these traits. For example look at all the Eq impls in src/libsyntax/ast.rs
.
It would good to have some way to auto-generate impls that compare values in the same way that the old polymorphic comparison functions did. This would be similar to the deriving feature of Haskell: http://en.wikibooks.org/wiki/Haskell/Classes_and_types#Deriving.
The syntax might look something like:
struct Bob deriving Eq, Ord {
some: Boo,
struct: Foo,
fields: Hoo,
}