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

C# Feature Request: Allow value tuple deconstruction with default keyword #25256

Closed
KnorxThieus opened this issue Mar 6, 2018 · 2 comments
Closed

Comments

@KnorxThieus
Copy link

Hi,
I apologize for neglecting the form, but I see not how to fill "expected behavior" etc. correctly.

In C# 7, we currently are able to use the default keyword in the following way:

int x = default;
meaning
int x = default(int);

We also can use tuple deconstruction like that:

(int x, bool y) = (42, true);
Or with the default keyword:
(int x, bool y) = default((int, bool))
But what seems to be impossible to me at the moment is this pattern of syntax:
(int x, bool y) = default;

In my eyes, the is some kind of logical gap that deserves to be filled soon. Okay, in this example, we could either write
var (x, y) = default((int, bool))

But assume x and y have been declared already before, then the use of var keyword is not possible.
That's why I would like to propose allowing this syntax.

While enjoying this language for a few years now, I am new to this forum, so I would be thankful to someone explaining me what's happening next with this proposal - if not already submitted by another user, but I couldn't find one. Thank your for your attention!

@svick
Copy link
Contributor

svick commented Mar 6, 2018

I think this is currently behaving as designed, which means this is a request to change the language, not the compiler. And such requests belong to the csharplang repo. Can you move this issue there and close it here?

@KnorxThieus
Copy link
Author

Oh yes, sorry I didn't know. Thank you!

Moved to csharplang repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants