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

Champion "Mix Declarations and Variables in Deconstruction" #125

Open
2 of 5 tasks
Tracked by #829
gafter opened this issue Feb 15, 2017 · 4 comments
Open
2 of 5 tasks
Tracked by #829

Champion "Mix Declarations and Variables in Deconstruction" #125

gafter opened this issue Feb 15, 2017 · 4 comments
Assignees
Labels
Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification Proposal champion Proposal Smallish Feature
Milestone

Comments

@gafter
Copy link
Member

gafter commented Feb 15, 2017

  • Proposal added
  • Discussed in LDM
  • Decision in LDM
  • Finalized (done, rejected, inactive)
  • Spec'ed

See

@gafter gafter changed the title Champion Mix Declarations and Variables in Deconstruction Champion "Mix Declarations and Variables in Deconstruction" Feb 21, 2017
@gafter gafter added this to the 7.1 candidate milestone Feb 21, 2017
@MadsTorgersen MadsTorgersen modified the milestones: 7.1 candidate, 7.X candidate May 16, 2017
@MadsTorgersen MadsTorgersen modified the milestones: 7.X candidate, 8.0 candidate Oct 9, 2017
@nelsonlaquet
Copy link

This feature would clean up code that propagates statuses and errors via tuples, similar to error handling in Go.

For example:

Err err;
Ret1 ret1;
(ret1, err) = await Func1();
if (err) return (default, err);

Ret2 ret2;
(ret2, err) = await Func1();
if (err) return (default, err);

Could turn into:

Err err;
(var ret1, err) = await Func1();
if (err) return (default, err);

(var ret2, err) = await Func1();
if (err) return (default, err);

Which is much easier to read IMO.

@mms-
Copy link

mms- commented Feb 10, 2019

Unless there are good technical reasons not to, this definitely should be implemented, it is just natural.

@gafter gafter added this to 8.0 Candidate (not started) in Language Version Planning Mar 6, 2019
@MadsTorgersen MadsTorgersen moved this from 8.0 Candidate (not started) to 8.x Candidate in Language Version Planning Apr 29, 2019
@gafter gafter modified the milestones: 8.0 candidate, 8.X candidate Apr 29, 2019
@gafter gafter moved this from 8.x Candidate to Any Time in Language Version Planning Sep 16, 2019
@gafter gafter modified the milestones: 8.X candidate, Any Time Sep 16, 2019
@alrz
Copy link
Member

alrz commented Mar 25, 2020

Linking #3304 here since I believe they belong to the same bucket - would be a nice-to-have syntax relaxation for the deconstruction feature.

(var sum, count: someExistingLocation) = e;

@jcouv
Copy link
Member

jcouv commented Jan 28, 2021

This was merged under LangVersion=Preview as part of VS 16.10. Thanks @YairHalberstadt for the contribution!

@jcouv jcouv modified the milestones: Working Set, 10.0 Jan 28, 2021
@333fred 333fred removed this from 10.0 Candidate in Language Version Planning Feb 6, 2021
@333fred 333fred added the Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification label Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification Proposal champion Proposal Smallish Feature
Projects
None yet
Development

No branches or pull requests

7 participants