First contribution, guideline questions: impl Default for std::time::Instant

There is a section of the RFC for struct initialization which would allow

let foo = Foo {
    ts: Instant::now(),
    // All our numerous other fields are just defaults.
};

which covers (what I infer to be) your main use case. If you still wanted to put now() in the default by implementing Default on your own you could presumably still use a partial constructor.

1 Like

Any change in std must be strongly motivated. The first question you should ask yourself before proposing a change is: what problem does it solve in the first place? I fail to imagine such a problem, and I certainly fail to make sense of impl Default for Instant. What does that even mean? In my opinion, the name itself, Instant, indicates that there is no sensible default value for that.

My 0.02 €: deprecate Default entirely. Its semantics are so ill-defined that it's useless beyond acting as a glorified shorthand.

6 Likes

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