Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ilya-bobyr opened this issue Jun 4, 2020 · 1 comment
Closed

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

ilya-bobyr opened this issue Jun 4, 2020 · 1 comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@ilya-bobyr
Copy link
Contributor

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.

@jonas-schievink jonas-schievink added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jun 4, 2020
@ilya-bobyr
Copy link
Contributor Author

Here is a pull request: #73001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants