Smarter derive(Default) out-of-the-box?

Hello, there... :crab:

Couldn't find any information why std #[derive(Default)] doesn't support something like smart_default out-of-the-box? Would you be so kind to point me to the related issue if it exists? Otherwise, should such improvement go through the RFC process, or can be proposed directly in Rust repo?

1 Like

One reason why I think this shouldn't go into std (or, actually, that's not std, it's re-exported from core) is keeping the language not bloated. And the fact this derive is (I think) not implemented as procedural macro, but built in into the compiler (not sure there)?

And since there probably are valid reasons not to put it in there, it should go through RFC if you desire it, so people can discuss the drawbacks. You can of course try proposing it directly in the repo.

I'm working on proposing improvements to this at the moment.

Thanks, will look for the RFC in This Week in Rust.

1 Like

Thanks for the explanation.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.