44

We have received complaints about some recent edits that inserted Swift 3 code into Swift 2 answers. One such example is here. Moderators have rolled back these edits, only to have them reinstated.

On the one hand, the movement from Swift 2 to Swift 3 resulted in some significant API changes, so many answers no longer apply in the older version of the language. On the other, the general consensus is that existing answers by one person should not be edited by another to include new code. In fact, a smaller discussion has already been had about suggested edits inserting Swift 3 code.

Personally, I think these kinds of edits are problematic, because they slip unverified code in after the community has voted on the original state of the answer. I've seen enough cases of code edits breaking answers or injecting bad code that I'm wary of anything not vetted by the community. However, I believe the people providing these edits genuinely mean to keep things current.

Does the community believe that these are acceptable edits?

15
  • 37
    I think that those should be posted as new answers. Then, maybe a comment should be left on the original answer, inviting the original answerer to edit in the new code if they approve of it. Commented Dec 5, 2016 at 15:34
  • 4
    Related discussion from only yesterday: What is the correct way to handle changing APIs?
    – Glorfindel
    Commented Dec 5, 2016 at 15:36
  • "some recent edits" Do I assume correctly that this isn't confined to the user whose edit you linked?
    – jscs
    Commented Dec 5, 2016 at 15:44
  • 1
    hi Josh. in 90% of answers with swift, everyone just gaily edits, putting in the latest syntax. but whatever, is SO doesn't want it, saves time fo rthose who bothered
    – Fattie
    Commented Dec 5, 2016 at 17:45
  • 1
    Note that it matters, but it just occurs to me: when you now start going around un-doing the 100s of "swift 2" updates (then the 100s of "swift 3" updates) . . . indeed, I suppose the original writer also cannot update-edit in such a way. (After all, what difference? All the objections I see precisely apply to the original, as well as other, writers.)
    – Fattie
    Commented Dec 5, 2016 at 20:07
  • 4
    @JoeBlow "After all, what difference?" -- Authorship. It is generally assumed that authors can do pretty much anything with their posts short of outright vandalism. That leads to another question, though: exactly how seriously third-parties should take authorship when taking action?
    – duplode
    Commented Dec 5, 2016 at 20:15
  • 1
    "It is generally assumed that authors can do pretty much anything with their posts short of outright vandalism" that seems completely wrong on SO. authors can't even say delete their own posts. above there is talk of introducing wrong code; are you saying that's fine if the author does it? anyways cheers for now!
    – Fattie
    Commented Dec 5, 2016 at 20:53
  • 1
    This question is, IMO, kinda broad, depending on the answer's context: If the answer is relevant to a specific version of the API, then the edits are sabotage. If the answer is intended to be the latest, most up-to-date way to do it, then the edits are valid. If the answer is just intended to be a general-purpose answer, then it would likely be best for the edit to either be a new answer, or place the updated code in a distinct section in the original answer. Continuing to provide valid answers for older versions of any given API can be extremely useful. Commented Dec 5, 2016 at 21:43
  • 1
    @JustinTime I doubt anyone will look for answers that don't work now
    – Braiam
    Commented Dec 6, 2016 at 12:00
  • 2
    Related: How to add Swift answers to older iOS questions
    – JAL
    Commented Dec 6, 2016 at 14:28
  • 4
    @Braiam Most people wouldn't, but anyone interested in the old API (such as people that were working on a large project, which relied on parts of the API that were changed in the update, and don't have time to refactor the code yet; people supporting legacy programs; or people specficially interested in the older version) will have a harder time finding good resources as time goes on. It's not likely that there'll be a lot of people like that, but if there are, and/or the old version ever becomes popular again (maybe for retro programming?), only having answers for the latest Commented Dec 6, 2016 at 16:42
  • version of the API will lead to basically-duplicate-but-shouldn't-be-closed-as-duplicate questions (asking questions about the old version that used to have an answer, but have had their answer modified to only regard the new version now, and thus need a new answer), which will either consume unneeded space on the servers (one question could probably have answers for both the old and the new versions, or an answer that shows how to do it in both) or be unfairly closed as duplicates (since the question they're a duplicate of doesn't actually have an answer about the old version anymore). Commented Dec 6, 2016 at 16:43
  • It'd more-or-less be the inverse of new questions being closed as duplicates of no-longer-applicable older ones, where the question they're flagged as a duplicate of only has obsolete answers that don't actually apply to modern versions anymore. Now, there's no guarantee that this will happen, but I'd prefer to prevent it prematurely, unless it can be definitively guaranteed that no one will ever need the old answer again. Commented Dec 6, 2016 at 16:47
  • @JustinTime I'm not saying that we should remove code that works with old version, but preventing others from updating the same posts with the new, cause far more damage than good (and as you noted, editing out the old version has a minor impact, also, the information isn't lost, you just have to click the "edited x time ago" to obtain it.
    – Braiam
    Commented Dec 6, 2016 at 16:51
  • 1
    @Braiam Ah, okay. I may have misinterpreted, then. (And to play devil's advocate, if the old code was edited out, there would be no indication that it had ever been there, apart from when the post in question was posted; due to this, there wouldn't necessarily be any indication that if a reader clicked the "edited whenever" link, they'd find code relevant to older versions.) Commented Dec 6, 2016 at 18:29

3 Answers 3

51

I have no doubt that this user means well - and most users doing similar edits probably mean well too.

But such edits are not updates to the existing code, they are new answers entirely.

An update would be for example:

Answer: Use collection.enumerate() to iterate with an index.

Edit: In Swift 3, enumerate() has become enumerated().

And as much as I, personally, don't like to see such an edit and would prefer to see a new answer explaining the new syntax, it's still a valid edit, according to the Help and most Meta posts.

But this is not what we have here.

In the link you share, a whole new answer has been added to the existing one.

A few important issues arise in this case, most importantly this one: what if the added code is wrong?

There's also the issue of taking responsibility for one's own answers and being fair to the original posters.

Because, am I now supposed to downvote an answer with bad code added by user B since my downvote won't target the author of said code, the editor, but will target the OP instead?

Same for upvotes, really, why would I upvote an answer by user A if the code I like is actually the edited one from user B?

Such edits are destructive towards what makes Stack Overflow what it is: a repository of questions and answers where the community can vote to determine the quality of posts.

If someone injects their own answers into other users answers, then voting fairly is not possible anymore.

So my answer is: no, this is not acceptable. Edits should be of a much, much smaller scale, and should not introduce anything that would change the way users might want to vote on the answer.

11
  • 4
    While some of the examples in recent Meta discussions about the acceptable extent of edits were less radical than they might appear at first, this one definitely crosses the line. "[Edits] should not introduce anything that would change the way users might want to vote on the answer" might is an interesting, if not all-encompassing, heuristic for determining what is too radical (though perhaps "edits should not introduce anything that might lead to the answer score being lowered" would be even better).
    – duplode
    Commented Dec 5, 2016 at 16:31
  • 4
    is anyone concerned about "who gets votes" ... ?
    – Fattie
    Commented Dec 5, 2016 at 17:44
  • 4
    If, astoundingly, there's a concern about "who gets votes". The problem is: let's say someone comes along and pastes in the same answer as a new answer, but with the latest syntax and they say "here's nRewik's answer, but with latest syntax" ..... (you occasionally see just that happening) ... over time that new answer will get all the votes, and the excellent correct original answer won't get any votes. If (beyond all belief) there's a concern about "who gets votes on SO", then that is "unfair".
    – Fattie
    Commented Dec 5, 2016 at 17:56
  • 8
    @JoeBlow As long as it is properly attributed it is legal and something that at least I would like to see. Often times I vote both answers up as long as I find them helpful. Commented Dec 5, 2016 at 20:14
  • Are we any closer to this: "If this is now some sort of "SO decision" I'd imagine you'll want someone to go through and unwind the 100s (1000s?) of instances where people have edited in the swift 2, then swift 3 syntax, to answers."
    – Fattie
    Commented Jan 27, 2017 at 15:03
  • right? has anyone started work on that?
    – Fattie
    Commented Jan 27, 2017 at 15:03
  • This is stupid! Answers are solutions. Having a separate answer that only alters a code sample a bit to compile under a different version of Swift creates only and only noise. Also, there are still people that are forced for some reasons to still use older versions of Swift, does that mean that the answers containing old Swift version code samples should not be upvoted in favor of the latest version? Commented Mar 10, 2017 at 12:41
  • Things like thing create a lot of confusion and frustration, especially for newbies (in programming and SO too), that's why you only see > 5k rep people stating the "laws". Let us speak too! I'm tired of all-knowing guys closing questions just because they feel too stupid of a question for them. Commented Mar 10, 2017 at 12:42
  • @EricAya, This answer is stupid, and the fact that people take it into consideration. users shouldn't replace Swift 2 answers with Swift 3 ones, they should post the new syntax as a separate answer No!!! Users shouldn't replace answers, no one said that, ever. There should be edits that add the new syntax in the same answer. Commented Mar 10, 2017 at 13:19
  • What does this have to do with the topic discussed here? That's just off-topic rant. Commented Mar 10, 2017 at 13:20
  • @EricAya, No, but this is a great platform and I often find annoying things about it and the community which disappoint me :( Commented Mar 10, 2017 at 21:54
4

Stack Overflow is mainly about having good answers to good questions that help programmers.

The first thing you should do is write a new answer that solves both the Swift 2 and Swift 3 problems. The second thing you should do is comment on the original answer that things have changed in Swift 3, with a link to your new answer. Invite the original answerer to fold your answer into theirs.

Quite often the original answerer will do so, or ask you to do it. Then do it, mentioning that the original answerer said to go ahead. Once the top answer is updated, you can then delete your now duplicate answer.


If the original answerer doesn't come back, what I find happens is that your new answer (covering more current solution) ends up with upvotes over time; if there are no solutions to the current framework, it will end up in second place relatively quickly, and sometimes outvote the top answer.

If the original answerer is around, sometimes the checkmark moves. This tends to accelerate the process.

Regardless, unless the original answer has a huge nest of comments, your comment that "in Swift 3, look here" will tend to accumulate upvotes and get prominent, which will let people find it even on a multi-page answer list.


If you don't like this solution, and you really want to edit it in, I personally don't see all that much harm. If your addition isn't extremely good, I would expect people to roll it back. If it is a great addition, I would say it should stay around.

While the voting process for Stack Overflow doesn't provide the "quality filter" we'd like here, it shouldn't be impossible to determine if it is a great, mediocre or horrible addition to the original answer. And the point of Stack Overflow isn't the voting system, but generating great answers that are easy to find.

So if you want to edit, either make it brief, or do an amazing job, or get it rolled back and suck it up. And if the original answerer objects, don't dare force it.

The solution where you create a comment and an answer avoids all of these problems.

5
  • 2
    "If the original answerer doesn't come back, what I find happens is that your new answer (covering more current solution) ends up with upvotes over time" that's what theory says it should happen, I've yet to see a example where a +crapton upvotes, is overcome with a newer answer.
    – Braiam
    Commented Dec 5, 2016 at 22:04
  • 2
    @braiam 4 years later: stackoverflow.com/a/31457319/1774667 How much is a crapton? The original was over 40 if I remember correctly. And the checkmark did move, I forget exactly when, maybe 10-20 on the new answer? Commented Dec 5, 2016 at 23:24
  • That's not fair if the accepted answer change, since most people upvotes the "best" answer, and the checkmark means that that's the best answer, no?
    – Braiam
    Commented Dec 6, 2016 at 12:02
  • 4
    @Braiam For that particular moved goalpost, you can just search for winners of the Populist badge, which finds situations where the unaccepted answer is 2x an answer that has at least 11 upvotes. Calibrate your "+crapton" as required. I have one at 12 votes on the accepted answer, vs 50+ on mine, which probably doesn't quality as "crapton". Finding cases where I don't double the accepted answer, but beat it, would require work; please define "crapton" before I bother: because I cannot find a case where "crapton" is "unboundedly large". Commented Dec 6, 2016 at 12:38
  • 2
    @Braiam here is one on its way, 4 years later and 1 year old at 54 vs 69 on main answer. Give it another few years. Commented Dec 6, 2016 at 12:44
-7

There is always difference between version regarding way of call,api and parameters. so any edit for swift version 2 reply or question is not acceptable with respect to swift version 3.

for example:

1 year before i asked someone what's the cost of leather jacket then at that time seller said 50$. but today, he comes up with new leather jacket with varying quality with 100$.

5
  • 4
    It is not clear to me how this answers the question.
    – Cody Gray Mod
    Commented Dec 6, 2016 at 13:32
  • 1
    Code Gray like if you are using the swift version 2.0 and you want help for swift version 2.0 and somebody provided you reply for that .but after few months somebody edit that reply or question with respect to 3.0 then its not usefull
    – suren
    Commented Dec 6, 2016 at 14:11
  • always its not needed that only technical word can explain the things in proper way.
    – suren
    Commented Dec 6, 2016 at 14:12
  • 2
    So what you are saying is, the question was originally asked about Swift 2.0, so only a Swift 2.0 answer is useful? The problem with that is our Q&A is not only for the person who originally asked the question. It's for everyone who many eventually come across the question. So keeping answers up to date is useful for new people who find the question via Google.
    – Cody Gray Mod
    Commented Dec 6, 2016 at 14:17
  • 2
    I suppose that what @suren means is that we don't want original answers being replaced with new versions. And of course I agree, a Swift 2 answer is still useful today and will continue to be useful, it should not be replaced by the Swift 3 version... but the topic of Brad's question is different, it's not about replacing, it's about adding updates and to what extent we can accept new code edited in existing questions.
    – Eric Aya
    Commented Dec 6, 2016 at 14:34

You must log in to answer this question.

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