Something about the name actor class
feels weird to me. Will there ever be actor struct
s or actor enum
s? If not, and actors will always be classes, why mention it at every definition?
I mean, the proposal says:
Actor classes behave like classes in most respects: the can inherit (from other actor classes), have methods, properties, and subscripts. They can be extended and conform to protocols, be generic, and be used with generics.
But then goes on to show a bunch of examples which would be valid in a class
but not in an actor class
. It's worth noting that methods, properties and subscripts are in no way unique to classes, nor are extensions, protocols or generics.
The only thing actors can do which is in any way class-like is support inheritance. To be honest, inheritance is often a massive pain (especially when considering things like subclasses and Equatable
), so most of my actors will be final
. I wouldn't even mind if they didn't support inheritance.
I see actors as a fundamentally new thing. They enforce data isolation in a way that is wholly unique in the language, and if anything is more like the grouped-exclusivity rules of value types than the very liberal rules which apply to stored properties of class
es.