[Pitch] Move Function + "Use After Move" Diagnostic

Great proposal! I'm sooo excited seeing Ownership progressing!

I'm curious as how this proposal fits with roadmap of Ownership / the plan laid out in the Ownership Manifesto?

Fairly early in the Ownership Manifesto, three "tentpoles" are presented:

Swift already has an ownership system, but it's "under the covers": it's an implementation detail that programmers have little ability to influence. What we are proposing here is easy to summarize:

  • We should add a core rule to the ownership system, called the Law of Exclusivity, which requires the implementation to prevent variables from being simultaneously accessed in conflicting ways. (For example, being passed inout to two different functions.) This will not be an opt-in change, but we believe that most programs will not be adversely affected.
  • We should add features to give programmers more control over the ownership system, chiefly by allowing the propagation of "shared" values. This will be an opt-in change; it will largely consist of annotations and language features which programmers can simply not use.
  • We should add features to allow programmers to express types with unique ownership, which is to say, types that cannot be implicitly copied. This will be an opt-in feature intended for experienced programmers who desire this level of control; we do not intend for ordinary Swift programming to require working with such types.

These three tentpoles together have the effect of raising the ownership system from an implementation detail to a more visible aspect of the language. They are also somewhat inseparable, for reasons we'll explain, although of course they can be prioritized differently. For these reasons, we will talk about them as a cohesive feature called "ownership".

AFAICT move (and "use after move" diagnostics is neither of those tentpoles?

So I wonder, is the Ownership Manifesto outdated and needs an update? move is mentioned rather late in the Manifesto, maybe it is just how my brain works, but I would have expected that the features to be implemented first in the journey towards Ownership, would be mentioned first/early in the manifesto.

Can the Core Team give a general update to the roadmap of Ownership?

Few us like to give estimates on when a feature is shipped, but I'm going to be annoying and ask anyway, is there a plan for Ownership to be implemented during Swift 6.X (not 6.0 or 6.1..), or is it rather Swift 7.X? Or is this completely unknown.

Also, what is the prio of Ownership compared to any other major language feature? Does it have higher prio than let us say Variadic Generics? Or is Variadic Generics """easy""" ("""small""" amount of work) compared to the vast feature(set) of Ownership? (tripple quotes to mark that I do not believe Variadic Generics to be easy to implement, but rather Ownership seeming to be a beast in comparison).

Cheers!

4 Likes