[Returned for revision] SE-0366: Move Operation + "Use After Move" Diagnostic

Hello, Swift community!

The review for SE-0366: Move Operation + “Use After Move” Diagnostic ended on August 8th. The Language Workgroup decided that the proposal is returned for revision.

Based on early review feedback, the proposal authors revised the syntax of the move(_:) function to a contextual move keyword. The Language Workgroup agrees that a contextual keyword is a better design because unlike normal functions, valid operands to the move operation cannot be expressed using types, and the keyword serves as marker for the compiler to perform additional analysis and emit diagnostics.

The remainder of the review surfaced a number of concerns about the details of the proposal:

  • Reviewers find a plain move x to be a worse spelling for throwing away the value from a moved binding than a discarded assignment _ = move x, or a separate keyword.
  • Some reviewers feel that move should only be permitted on an argument when the corresponding parameter uses the (currently experimental) __owned/__consuming convention.
  • Many reviewers feel that move is not the best name to describe what the operation does.

More broadly, many reviewers struggled to evaluate the proposal in isolation, without a more concrete understanding of how move will be used with other features from A roadmap for improving Swift performance predictability: ARC improvements and ownership control.

The Language Workgroup accepts that a move operation on copyable types as a contextual keyword is a valuable addition to the language, but agrees that the above details of the operation need to be considered holistically with the other features that the move operation will be composed with. The move operation is closely related to parameter modifiers that are discussed in the ownership control roadmap; the proposal authors of SE-0366 have pitched borrow and take parameter ownership modifiers, which includes a proposed revision to the name of the move operation. The name of the move operation and the parameter modifiers will be discussed together in that pitch thread. The pitch feedback will be used to revise the SE-0366 proposal before it is brought back into review, and SE-0366 can then be evaluated with more context about other ownership control features.

Thank you to everyone who participated in the first pitch and proposal review! Your contributions help make Swift a better language.

Holly Borla
Review Manager