3

This question is inspired by the proposed edit of this linked answer at the moment of writing.

The edit changes default(T); to default;, which is valid C# 7.1. Plus, the proposed edit adds a summary at the end.

While this arguably improves the question, I wonder if there is something lost in updating the syntax (for example, the answer would require a more modern compiler). Besides, I do not think we should go about doing such edits in bulk or encourage them (there could potentially be a lot of edits of that kind).

My question, is as the title says: Is it advisable to edit a third party answer to use new language features?

3
  • 3
    If the new syntax wouldn't work for a number of people, then at the very least, it should come with a disclaimer that the used syntax is only compatible with <version here> to ensure that, as you said, nothing gets lost (while also keeping the prior version of the code in the answer). I've seen people often post a new answer in this situation instead too. Commented Nov 30, 2019 at 4:12
  • 1
    @CertainPerformance Well, that gave me an idea of how to resolve the proposed edit.
    – Theraot
    Commented Nov 30, 2019 at 4:15
  • 12
    If the edit adds a new feature not available in older versions of the language, then it should be added as a new answer (along with a reference to the minimum version of the language that supports it). This will keep the old answer intact (which is important because of how long old language versions continue to be used with existing codebases), and allow the new technique to be properly up and down voted independently of the established answer. Commented Nov 30, 2019 at 4:23

0

Browse other questions tagged .