"Actors are reference types, but why classes?"

I'm still not sure I follow the rationale between disallowing stored static properties. My point was more that if you want to disallow:

actor Foo {
  static let foo = 42
}

but allow:

protocol Foo {
  static var foo: Int { get }
}
enum Bar: Foo {
  static let foo = 42
}
actor Baz<T: Foo> {
  static var foo: Int { T.foo }
}
let baz = Baz<Bar>()

It may prevent a few obvious bugs but I don't think you'd be achieving that much, and you may force a number of valid use cases to use the more convoluted structure in the second example.

4 Likes