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

#1

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?

#2

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.

#3

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

#4

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

1 Like
#5

Thanks for the explanation.