Support records on .net framework and netstandard 2.0 target #4735
-
I don't understand the reason why records aren't supported out of the box in .net framework or netstandard targets. Most of the existing codebases would benefit from it, and it shouldn't be a big deal to provide support for the constructor syntax, dismissing the Improvements on grounds of immutability and shorthand declaration to cut the clutter benefit the existing, larger codebases more, in quantifiable manner, it helps the language stir in the right direction more codebases in the wild. Instead, people have to go the "artisanal route": Meaning more clutter, more unsupported stuff, in each projects that needs to define records. This is not helping the C# ecosystem and developers that are restricted to targets < net 5.0 (the vast majority of C# developers). What was the deciding factor for not shipping that for "everything but the very latest"? Can this be addressed? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Are you asking for the compiler to declare an internal static class
https://www.surveymonkey.com/stories/SM-GDSVMB2C/: While the 4,486 respondents probably self-selected in a way that didn't make them representative of all C# developers, 38% is the maximum percentage that could possibly have been restricted to targets < net5.0 and likely the percentage is even smaller (some, like me, are not restricted from targeting net5.0 and just didn't do it yet). Again, it's hard to estimate the effect that the sampling bias might have. But for me it lowers my credence for the statement "the vast majority of C# developers are restricted to targets < net5.0." |
Beta Was this translation helpful? Give feedback.
-
A moderator can close this discussion (as I can't), I hope nothing sounded disparaging:
Take away I'd like the C# team to consider: Not having the features available is not a good way for pushing people to ugprade their runtime/sdk, it just keeps C# developers away from picking up the new features for longer, and is detrimental to the idioms that ought to gain ground in more C# codebases. I wonder what is the cutoff to not go that extra mile, but it has seemed too low, judged with my own bias. |
Beta Was this translation helpful? Give feedback.
A moderator can close this discussion (as I can't), I hope nothing sounded disparaging:
modreq
(dotnet/fsharp#11564) which helped me understand there is no runtime changeTake away I'd like the C# team to consider:
Please do your best to go the extra length to bring features to all supported targets, people maintaining codebases frequently have no easy way to just transition out of .net framework, those codebases need the better C# as much as greenfield ones starting on latest runtime/sdk.
Not having the features available is not a good way for pushing people to ugpra…