Added: C# Language Design Notes for Jun 28, 2017 #723
Replies: 6 comments
-
And I just watched Jon Skeet's talk from NDC Oslo where he complained about this. 🤣 |
Beta Was this translation helpful? Give feedback.
-
I'm puzzled by the "Deconstruction without ValueTuple" part, as I thought this was already done for C# 7.1. I raised the request, "Suggestion: have the compiler optimise a multiple-assignment expression bodied constructor" on the roslyn repo and it has been closed by @jcouv as "fixed" for v2.1 of roslyn. Does that fix only avoid an unnecessary tuple for a deconstruction in a constructor? What am I missing here? |
Beta Was this translation helpful? Give feedback.
-
@DavidArno Check out Skeet's talk about C# 7. Somewhere half-way he expresses his annoyance that a deconstruction requires bringing in the |
Beta Was this translation helpful? Give feedback.
-
Yep, I get that. However, the docs around the PR fix for the issue I raised (Avoid creating "steps" in deconstruction binding and optimize output), refer to it fixing situations where |
Beta Was this translation helpful? Give feedback.
-
As far as I can tell the compiler isn't actually using |
Beta Was this translation helpful? Give feedback.
-
Previously, during binding, we would prepare the return value for the deconstruction (that means building a tuple type, thus requiring that the ValueTuple type be available in the compilation). The return value would not end up being emitted (it is optimized away when unused). But this would still mean a compilation error if ValueTuple is missing. This was brought up with LDM, since the last time the topic was discussed, we had concluded it is ok to require ValueTuple for all deconstructions. This latest design changes that (for the better). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
C# Language Design Notes for Jun 28, 2017
ValueTuple
Please discuss.
Beta Was this translation helpful? Give feedback.
All reactions