The actor model: Why is Erlang/OTP special? Could you use another language?

后端 未结 6 1756
失恋的感觉
失恋的感觉 2021-01-29 20:23

I\'ve been looking into learning Erlang/OTP, and as a result, have been reading (okay, skimming) about the actor model.

From what I understand, the actor model is simply

6条回答
  •  日久生厌
    2021-01-29 21:11

    Casablanca is another new kid on the actor model block. A typical asynchronous accept looks like this:

    PID replyTo;
    NameQuery request;
    accept_request().then([=](std::tuple request)
    {
       if (std::get<0>(request) == FirstName)
           std::get<1>(request).send("Niklas");
       else
           std::get<1>(request).send("Gustafsson");
    }
    

    (Personally, I find that CAF does a better job at hiding the pattern matching behind a nice interface.)

提交回复
热议问题