2

When I saw this answer: Comparing arrays, sets & their elements in SWIFT I wasn't sure if it was working properly, so I've tested it and added a better println statement to it when testing.

Results were interesting (and proved to me that the answer is ok) so I had the idea to replace the user's println(arrayOfPairs[index]) with my own more detailed one. It wouldn't change the answer's logic, but it would definitely be a significant edit.

But just after doing it, when I saw the result, I was feeling like I was putting words in the user's mouth, exactly like @matt mentions here: https://meta.stackoverflow.com/a/281126/2227743

Besides, this user's hasn't posted a lot, so I was a bit afraid to confuse him/her with my edit if they're new to SO.

So I deleted my edit and rollbacked to the original user's answer.

Is there a recommended way to deal with this? I mean, how do you judge if your edit to an answer is within the accepted behavior?

3
  • Is there any reason you couldn't just add your proposed amendment as a comment? Then it's up to the user to decide if it fits with the intent of his answer?
    – Stefan
    Jun 19, 2015 at 9:32
  • Indeed it was my first thought, but my amendment was a big line of code which wouldn't have fit properly in the comments at all, it would have been an unreadable mess. I also wondered if I could just tell the user something like "your answer works but is not clear, you should add a better println for your example" but it also felt wrong to me.
    – Eric Aya
    Jun 19, 2015 at 9:36
  • Brevity in a code sample is an asset, pretty unlikely that an elaborate println() makes it better. You could upvote an answer after you found out that it is correct. Jun 19, 2015 at 11:02

1 Answer 1

2

The original answer isn't great. The code may be functional, but there's no explanation, and the debug could be improved as you've observed. So in this case it's probably best to write a new answer, credit the original author, but build on his answer and provide the required explanation.

I guess you're worried about taking reputation points from a new user, which a reasonable concern. But you're also helping him by showing him how it's done. If you teach him how to post a better answer next time, he's still getting value from your attention.

If the original answer was great, and you only had a minor tweak to suggest, it would be better to add a comment.

3
  • Yes, I was worried about being hijacking his answer if I would just take his code and add my debug statements to make my own answer. But I understand your point, it's interesting, I'll think about it next time.
    – Eric Aya
    Jun 19, 2015 at 9:47
  • "or directly message the user" - that isn't possible, is it?
    – Gimby
    Jun 19, 2015 at 11:42
  • @Gimby - Fair comment, post updated.
    – Stefan
    Jun 19, 2015 at 11:44

You must log in to answer this question.

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