11

A number of posts on meta discuss what should or shouldn't be dealt with in an edit, but one thing I can't find any guidance on is whether an edit should change code to reflect a newer version of a language. For example, I'm seeing a lot of edits with edit descriptions along the lines of "Updated to Swift 2.0" and "Swift2 compatible." Posts like this one talk about leaving questions posed in a certain version of software as-is since it may indeed be helpful in the future for another user of the same software and version.

However, SO is pretty aggressive when it comes to encouraging people to include code in an answer and providing links which won't go bad in the future. But any inclusion of code into an answer will inevitably introduce a version of the language into the answer (albeit, languages don't often change so drastically that code from a version or two behind is useless in the latest version). The reasoning to include code in answers is understandable. But if the original question is less about the language and syntax and more of an SDK or platform issue, then it's fairly likely to exist in different versions of the language--since it's not a language issue to begin with. Thus, someone with a problem originally written in Swift 1.0 may be helpful to someone with the same problem now using Swift 2.0.

I've also seed answers where someone proposes an edit to the answer and adds a header to specify the code for a specific version of the language like:


Updated for Swift 2.0:

code for Swift 2.0 would be here...


So my question is this, if I'm presented with a edit that simply changes the code to a different version of the language, what's the best course of action?

Here are some options I've thought of:

  • Reject the edit altogether (ensure the generic language tag is used and anyone viewing the answer will have to translate accordingly)
  • Improve the edit and move the updated code into a new section labeled appropriately like shown above
  • Tag the question with better tags (I hinted at this when I said some questions are less language focused and more SDK/platform related)
10
  • 2
    Case by case basis. I would allow edits that don't break it in the older version, or do so in a way that leaves the older version in tact.
    – Kevin B
    Commented Oct 22, 2015 at 16:42
  • 4
    I'm not familiar with the compatibility of swift and swift 2, but updating code to ensure compatibility with swift 2 sounds like it could easily break original swift 1 code. And that seems like a really good reason to reject the edit as "Conflicts with author's intent".
    – ryanyuyu
    Commented Oct 22, 2015 at 16:42
  • Okay, that option works if you're familiar with the language...I try to skip edits when they deal with languages I'm not familiar with, but if the edit included a separate section, as a reviewer, I wouldn't need to know the intricacies of the language to approve.
    – Glen Selle
    Commented Oct 22, 2015 at 16:45
  • I think i would still skip it, as I'd have no way of validating whether or not the code being added is correct. If it's incorrect, that could directly impact the score of the answer in a negative way.
    – Kevin B
    Commented Oct 22, 2015 at 16:46
  • I wouldn't update to Swift 2.0 - Since 2 (and 1.2) has breaking changes, the only logical choice is to identify the version of Swift in the question. I'm sure there are enterprise Swift 1.1 apps that need a 1.1 answer.
    – timpone
    Commented Oct 22, 2015 at 17:32
  • 1
    My take, as someone with little experience on this site, but two decades moderating on Compuserve, newsgroups and forums hosted by MSFT: The second option. Leave the original posts intact and include updates, appropriately labelled, contributed by later contributers as separate... somethings. Unfortunately, code doesn't fit well into Comments, but these contributions aren't truly "Answers". It would be nice to have a third category, unless "Community Wiki" would be the right solution? Commented Oct 22, 2015 at 17:36
  • @CindyMeister I generally like the second as well. It keeps the original code in tact, provides an updated solution for those on newer versions and also reduces the need for reviewers to know the language in-depth and thus know if the updated code breaks in older versions. BTW, long time no see ;)
    – Glen Selle
    Commented Oct 22, 2015 at 17:59
  • Are you THE Glen, friend-of-my-brother? Really LTNS! Commented Oct 22, 2015 at 18:07
  • 1
    No, no. Don't know that Glen. I asked you to edit your answer the other day to remove the question.
    – Glen Selle
    Commented Oct 22, 2015 at 18:08
  • 1
    Ah, right, THAT Glen <red-faced> Commented Oct 22, 2015 at 18:16

1 Answer 1

9

It depends a little bit on the question. If the question is tagged with (or refers to) a specific version of a language (or framework or whatever) and the edit introduces code for a different version, I would reject as conflicting with the author's intent. It doesn't really make sense to say "I need to Foo the Bar in Baz v1" with "Using Baz v2 you can Farmaz the Jingerflog instead". If I saw that as an answer it would get an immediate downvote for not reading the question and providing an irrelevant answer. Since that would make the answer less useful, it doesn't make a good edit.

In the case where the question is version agnostic, I would just improve the edit by adding a "Updated for vX.X" section so that the old (and still useful) answer survives along with the new up-to-date answer.

1
  • 4
    Farmaz the jingerflog. I think I'm going to steal that.
    – theB
    Commented Oct 22, 2015 at 18:50

You must log in to answer this question.

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