Not planned
Description
Allow (int i, string s) = default;
and (i, s) = default
.
- Proposal addedDiscussed in LDM (by email so far)Decision in LDMFinalized (done, rejected, inactive)Spec'ed
Initially raised in #1358 (thanks @KnorxThieus)
Prototype in decon-default branch
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
AustinBryan commentedon Jun 11, 2018
This will be super nice to do in constructors:
jnm2 commentedon Jun 11, 2018
@AustinBryan Those fields are already zero-inited, so what is the purpose of that constructor?
alrz commentedon Sep 12, 2019
The use case I had in mind for this is assigning a bunch of out parameters on a failure case,
btw I think this is already implemented by jcouv, why the Any Time milestone?
jcouv commentedon Sep 12, 2019
The implementation I have is not quite complete because we've recently implemented more target-typing scenarios (switch expressions in particular). So
(i, d) = expr switch { true => (1, null); _ => throw null; };
should work too (ie. giving the tuple in branch a type).Rekkonnect commentedon Jul 8, 2022
Taking some time into the code regarding this case, and a side-effect would have to also be matching the individual types of the tuple expression:
should match as
(int, string)
, whereasshould match as
(int?, string)
.I'm awaiting for a response on whether it's okay to follow this approach in another branch targeting the
features/decon-default
branch, which could be considered a relevant but different feature.Rekkonnect commentedon Jul 24, 2023
@jcouv are there any updates on this moving forward? #1358 is still in the Working Set, and the only scenario that I believe was indeed left is the target typing from switch expressions.
jcouv commentedon Nov 19, 2024
Closing as duplicate of #1358