Improving Sendable

Hi all, I'm about to revise this proposal based on feedback here and more experimentation with enabling Sendable checking in apps and seeing where the fallout is. One of the things we tripped over is that the limitations on inference of Sendable for public types is unfortunate. If I have something like this:

public struct Point {
  var x, y: Double
}

It doesn't get a Sendable conformance. We don't infer Sendable conformances for public types because we didn't want to make an implicit promise to other modules that the Sendable conformance exists, but there is a better model for this: scoped conformances. If we could infer the Sendable conformance but keep it internal to the module, then we would only need to explicitly write Sendable when we want to export that information to clients (and commit to it). It's more in line with, e.g., the synthesized member initializers of structs being internal.

I'll write it up as part of "version 2" of this pitch, but... what do you think?

Doug

18 Likes