Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRFC: Allow external #[deriving(...)] implementations #480
Comments
rust-highfive
referenced this issue
Nov 24, 2014
Closed
RFC: Allow external #[deriving(...)] implementations #11813
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I believe this has since been implemented, so closing. |
alexcrichton
closed this
Feb 11, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rust-highfive commentedNov 24, 2014
Sunday Jan 26, 2014 at 06:47 GMT
For earlier discussion, see rust-lang/rust#11813
This issue was labelled with: A-syntaxext in the Rust repository
Background
Now that #11151 has landed, third-party code can define syntax extensions just as the compiler does - with the exception of adding new types to
#[deriving(..)]. It is possible to write an extension that does the same thing as#[deriving(..)]does, but it has to be implemented as#[deriving_MyTrait]instead of#[deriving(MyTrait)]. This unfortunate, especially when a user wants to derive multiple first- and third-party traits:The repetition of multiple
#[deriving_Foo]s was the driving force for the creation of#[deriving(..)]in the first place!The Proposal
Change the signature of the macro registration function to this:
#[deriving(..)]types will be registered by the extension infrastructure just like other syntax extensions are.This does have a (potentially) large downside: the extension infrastructure will have to have special knowledge of
#[deriving(..)]to keep track of the registered extensions. I think it's probably worth it, and there are already some other "special" extensions liketrace_macros!. What does everyone else think?