You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Right now to use deriving/auto you have to add individual annotations on types:
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:into:
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, butderive
orderiving
has precedent. I don't really care.The text was updated successfully, but these errors were encountered: