Closed
Description
Right now to use deriving/auto you have to add individual annotations on types:
#[deriving_eq]
#[deriving_ord]
#[auto_encode]
#[auto_decode]
struct Foo { }
This is tedious and an eye-sore. However, it has the advantage that if some third-party X comes along and implement a trait Bar, they can implement a syntax extension #[deriving_X]
that fits right in. Therefore, I propose we have a "meta" syntax extension called #[derive]
or #[auto]
(I will use auto in the examples that follow) that would expand the following declaration:
#[auto(Eq,Ord,Bar)]
struct Foo {}
into:
#[auto_Eq]
#[auto_Ord]
#[auto_Bar]
struct Foo {}
This makes deriving convenient to use while preserving the ability for third-parties to seamlessly integrate.
As for what to call it: auto
seems like a clearer name for those not familiar with Haskell, but derive
or deriving
has precedent. I don't really care.