[rust-dev] Deriving keyword

Patrick Walton pcwalton at mozilla.com
Fri Jan 24 08:36:06 PST 2014


On 1/24/14 12:28 AM, Lee Braiden wrote:
> What exactly is the point of this #[...] syntax, anyway?  I'm sure
> there's a reason, but I *currently* don't see how #[deriving(...)] is
> better than simply "deriving", like Haskell has.  Is maintaining a low
> keyword count really THAT important, that we have to have ugly #[]
> wrappers around things?  I had thought that #[] represented
> meta-information, like how to compile/link the file, but if deriving is
> in there, it's very much involving the language proper, too.

`#[]` is also a macro invocation syntax.

> Also, if it's built into the compiler, that makes it special anyway, in
> my book.  However, the derivation feature provides such great
> functionality, that I'd be very OK with it being a keyword.  At least,
> if it could be extended for other types -- i.e., was made to support
> deriving_Drawable and so forth.

The plan is to allow user-defined deriving via the macro system.

Patrick


More information about the Rust-dev mailing list