Skip to content

Free default() function to augment Default::default() #73000

Closed
@ilya-bobyr

Description

@ilya-bobyr

It feels a bit redundant to have to say Default::default() every time I need a new value of a type that has a Default instance.
Especially so, compared to Haskell, where the same functionality is called def.
Providing a free default() function that forwards to Default::default() seems to improve the situation.
The trait is still there, so if someone wants to be explicit and to say Default::default() - it still works, but if imported as std::default::default;, then the free function reduces typing and visual noise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions