1

I suggested a small edit to an answer to make a bit of code more clear, only to have it rejected 3-2. I resubmitted it (as I think that this was mistakenly rejected, and resubmitting was the suggested remedy from another meta post), and it was rejected 3-1. Both times the tag is "This edit changes too much in the original post; the original meaning or intent of the post would be lost."

https://stackoverflow.com/review/suggested-edits/5620178

https://stackoverflow.com/review/suggested-edits/5620911

The answer, concerning how to get pretty strings for types, has a block

std::unique_ptr<char, void(*)(void*)> res {
    abi::__cxa_demangle(name, NULL, NULL, &status),
    std::free
};

which I changed to

std::unique_ptr<char, decltype(&std::free)> res {
    abi::__cxa_demangle(name, NULL, NULL, &status),
    std::free
};

Functionally these two are equivalent, but I think that the style is nicer in my edit and makes the intent of the line much more clear (ie. it takes a second to figure out what the void(*)(void*) means, but it's just the type signature of std::free. So why not just say that outright?).

Anyway, I don't want to get in an edit war or anything but I was surprised that this was rejected. Are these not the type of edits that I should be making? And if so, why not?

3
  • 11
    Changing code in a suggested edit is always risky. A number of people will outright reject any edits that do anything to code other than change the indentation (and even that gets rejected under certain tags). There's been numerous instances in the past where a well-meaning individual has edited the code in a question and inadvertently fixed the problem that the OP was experiencing, although this is less true of answers.
    – JonK
    Commented Aug 25, 2014 at 17:50
  • 16
    even for an answer I suggest adding a comment that using decltype would be clearer. If the author agrees one of you can then make the edit - if it's you be sure to mention the comments in your edit summary to increase approval chances Commented Aug 25, 2014 at 17:52
  • That's probably a good call, @KateGregory. Thanks.
    – mindvirus
    Commented Aug 25, 2014 at 17:54

2 Answers 2

6

Please continue to make such edits. As it says in the editing guidelines:

When should I edit posts? (…)

  • To clarify the meaning of the post (without changing that meaning)
  • To include additional information only found in comments, so all of the information relevant to the post is contained in one place
  • To correct minor mistakes or add updates as the post ages

This is not limited to spelling errors. Improvements to code are encouraged as well. Don't propose a new algorithm or make major changes to the logic, but do make simple bug fixes, or improve the clarity of the code (as long as it is objectively a clarification, and not a matter of style).

Unfortunately, as you've discovered, there is a group of reviewers on Stack Overflow who, for some reason, refuse improvements to the code parts of answers (this is an old problem). Sorry about this. Please don't let them distract you from making the site better.

1
  • This turned into a way bigger deal than I thought it would! I feel like I stumbled upon a very strange corner of StackOverflow. Thanks for the links.
    – mindvirus
    Commented Aug 26, 2014 at 19:46
1

Don't change the content of answers. You can fix spelling and wording and grammar and formatting and presentation - but the code is part of the content.

Anyway, the correct reject reason for your edits is:

invalid edit: This edit is incorrect or an attempt to reply to or comment on the existing post.

You can post a comment mentioning problems with answers.

20
  • 1
    I don't think that it was that either - just cleaning up a confusing bit of syntax, not central to the answer. Is that really outside of the scope of what people should be editing?
    – mindvirus
    Commented Aug 25, 2014 at 20:36
  • 2
    @mindvirus Edit reviewers are moderator-type folk, it's best not to make us evaluate technical accuracy. Once you get 2k, it's a little looser, but keep in mind that OP might not want the edit (unless it's community wiki, where you can edit all you want!).
    – bjb568
    Commented Aug 25, 2014 at 20:37
  • 3
    @bjb568 - agree that this edit is improper, but it is not "an attempt to reply or comment" but rather a strong example of the changes too much reason under which it was originally closed. Commented Aug 25, 2014 at 21:33
  • 2
    This means nothing wrong will ever get corrected, which isn't that good for a Q&A site... Yes, you can add another answer but there are times when this is not going to make a difference (too old/highly voted etc.)
    – Ben
    Commented Aug 25, 2014 at 22:08
  • @Ben: Don't forget we have hundreds of folks above 2000 reputation who can make edits without review approval.
    – Robert Harvey Mod
    Commented Aug 25, 2014 at 22:44
  • 2
    @Chris, correcting an incorrect answer that's really close and has a lot of votes is hardly co-opting. Changing it to a completely different answer would be. You've read somewhere that editing code is evil and now seem to be enforcing SE unknown rules. I would suggest rereading MSE and the licence. Robert and astro's point about this only effecting people less than 2k is well put; though I still fundamentally disagree with the statement at the top.
    – Ben
    Commented Aug 26, 2014 at 6:38
  • 5
    @Ben - no, sneakily substituting your opinion of what the correct answer should be, for one which has already garnered high community approval (even if, in your opinion it is incorrect), is generally wrong. Make your case in comments on the allegedly incorrect answer, and post your own answer so that it can be judged on the comparative merits. And keep in mind that the answer at issue here was not alleged to be incorrect - instead, the poster wanted to use a different method out of personal preference. Edits are for things like typos. Commented Aug 26, 2014 at 14:39
  • 2
    @Chris, I haven't looked at this case; I'm commenting on the general principle of editing code in answers. The community disagrees with you and this answer on that point (finally found it). If you'd like to change the consensus please create another question to address it.
    – Ben
    Commented Aug 26, 2014 at 15:51
  • 2
    @Ben you really need to re-read your own link, as it strongly contradicts your opinion. Under editing Answers the list of things not to do explicitly says "Change the code logic or functionality — even if you think you're correcting it" Commented Aug 26, 2014 at 15:55
  • 3
    Let's ignore this specific example @Chris. "Don't change the content of answers" and "making an answer work is a good thing" is a strong contradiction; the one I'm attempting to point out. One forbids all editing to answers, the other sets out circumstances in which it's okay. A blanket ban on all editing of answers is not what we as a community should be aiming for and is not the current community consensus. We're obviously arguing different points here...
    – Ben
    Commented Aug 26, 2014 at 16:18
  • 1
    @Ben The "content" of an answer isn't the whole answer. Changing "i" to "I" is obviously right. Changing "don't do it" to "do it" obviously isn't.
    – bjb568
    Commented Aug 26, 2014 at 16:19
  • 2
    Yes @bjb. But, changing i ;= 1 to i := 1 (or i == 1 to i = 1 for an assignment is changing the code and the content of an answer but without changing the essential meaning. It's making an incorrect answer correct.
    – Ben
    Commented Aug 26, 2014 at 16:27
  • 3
    This is a ridiculous and unprofitable argument to have @bjb. If something is provably incorrect and a simple change will correct it then I will make the change. I'm not posting a new answer to get rid of a little error and I'm not praying that someone reads my comment. It happens the community agrees with me; there is no requirement for you to do so. I don't make large changes to code in answers 'cause then it'd be a different answer but I don't see how a dogged determination to ignore errors helps the site in any way. Let's agree to disagree.
    – Ben
    Commented Aug 26, 2014 at 19:45
  • 2
    @ChrisStratton first of all, I really don't appreciate the insults. I was not trying to be sneaky, nor was I trying to jump the queue. I was trying to clarify one part of one line out of over 40 in an answer. It was more akin to changing "add 8 half teaspoons of salt" in a recipe to "add 1 tablespoon of salt". Not trying to take credit, not trying to co-opt the author, was just trying to clear up a confusing bit of their code.
    – mindvirus
    Commented Aug 26, 2014 at 23:05
  • 1
    @mindvirus - you might note the post you seem troubled by was explicitly addressed to a named individual other than you, who was proposing to edit answers he felt were actually incorrect. Your own change was stylistic and I would strongly dispute "clarifying". Commented Aug 27, 2014 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .