SE-0316 (second review): Global Actors

From the proposal..

The global actor type need not itself be an actor type;
it is essentially just a marker type that provides access to the actual shared actor instance via shared. 

Whether class based globalActor support inheritance?

@globalActor
class Base{
    static let shared = Base()
    // shared mutable states...
}
//OR
@globalActor
class Base{
    actor SomeActor {}
    static let shared = SomeActor()
    // shared mutable states...
}
class Sub:Base{...}//propagate @Base globalActor attritube

We have class and actor as separate ref type, but how about @globalActor class ...? Is it a class or (global)actor, or a class as @globalActor with class-inheritance capability?

In other words, @globalActor class is a special type in-between with class+actor duality?

  • class
  • @globalActor class
  • actor

but this should definitely work, right?
@GA
class Base{...}

class Sub:Base {...}

Both Sub and Base share the same @GA globalActor, and support actor-like inheritance without problem.

1 Like