mutex త classɻॴ༗త var ඃ mutex อޢɻ actor BankAccount { let accountNumber: Int var balance: Double init(accountNumber: Int, initialDeposit: Double) { self.accountNumber = accountNumber self.balance = initialDeposit } } Swift Actor
proposal ။Ճɻ • ՄҎ์ࡏ፤ိఆٛಛԽత protocol protocol DataProcessible: Actor { // only actor types can conform to this var data: Data { get } // actor-isolated to self } extension DataProcessible { func compressData() -> Data { // actor-isolated to self } } actor MyProcessor : DataProcessible { var data: Data // okay, actor-isolated to self func doSomething() { let newData = compressData() // calling actor-isolated method on self } } Actor type
Reply Reentrant Swift Yes Static, Compiler invoke methods No, compiler invoke methods Automatic, Typed Yes. Can be called from self Erlang Yes Dynamic Send anything Yes Manual, Need to know sender No. Receive blocks actor.