Christopher Baines <m...@cbaines.net> skribis:

> I'm not very familiar with actors, but I guess that's similar to having
> a bunch of cooperating fibers which handle different things.

Yes.  Specifically, actors here are a fiber together with a channel;
each actor looks like:

  (let loop ((state …))
    (match (get-message channel)
      ;; handle request and call ‘loop’
      ))

The actor keeps serving requests it gets on its channel.

It makes quite a difference when you start framing it this way.  When I
first fiberized Cuirass years ago, I’d just use ‘spawn-fiber’ here and
there where concurrency was needed.  Thinking in terms of actors makes
the code clearer, allows you to think about “concurrency units”, respect
separation of concerns, and so on.  (Our Spritely comrades would explain
this much better!)

Ludo’.

Reply via email to