Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). These changes range from

  • "minor changes", such as renaming println to print, over
  • "medium changes", such as replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...), to
  • "major changes", such as a completely new error handling model (throw/try/catch).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). These changes range from

  • "minor changes", such as renaming println to print, over
  • "medium changes", such as replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...), to
  • "major changes", such as a completely new error handling model (throw/try/catch).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). These changes range from

  • "minor changes", such as renaming println to print, over
  • "medium changes", such as replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...), to
  • "major changes", such as a completely new error handling model (throw/try/catch).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

Tweeted twitter.com/StackCodeReview/status/678052919955103744
Added more Swift-specific information, and information about major language changes.
Source Link
Martin R
  • 24.2k
  • 11
  • 11

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). Some (non-representative) examples are These changes range from

  • Renaming"minor changes", such as renaming println to print, over
  • countElements(string) to string.count to string.characters.count for the length of a string "medium changes",
  •   such as replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...), to
  • "major changes", such as a completely new error handling model (throw/try/catch).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). Some (non-representative) examples are

  • Renaming println to print,
  • countElements(string) to string.count to string.characters.count for the length of a string,
  •   replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). These changes range from

  • "minor changes", such as renaming println to print, over
  • "medium changes", such as replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...), to
  • "major changes", such as a completely new error handling model (throw/try/catch).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

added 727 characters in body
Source Link
Martin R
  • 24.2k
  • 11
  • 11

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). Some (non-representative) examples are

  • Renaming println to print,
  • countElements(string) to string.count to string.characters.count for the length of a string,
  • replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). Some (non-representative) examples are

  • Renaming println to print,
  • countElements(string) to string.count to string.characters.count for the length of a string,
  • replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). Some (non-representative) examples are

  • Renaming println to print,
  • countElements(string) to string.count to string.characters.count for the length of a string,
  • replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

edited tags
Link
Simon Forsberg Mod
  • 59.7k
  • 1
  • 79
  • 174
Loading
edited title
Link
Martin R
  • 24.2k
  • 11
  • 11
Loading
Source Link
Martin R
  • 24.2k
  • 11
  • 11
Loading