by @holsee
with examples in Elixir
Actors are...
A Fundamental
Unit of
Computation
In order to bring sanity to
"everything is an Actor, and Actors have Mailboxes, which are also Actors which then must have Mailboxes of their own..."
There are the following truths:
i.e. Mailboxes are Special Actors
In walks Futures which provides a reference to a result which has not yet been computed.
And in the context of Actors that boils down to an Actor which has an address, that will hold the result, when it is available.
A Future for a Bushell of Wheat (not now but in the Future),
when the harvest takes it will resolve to a Bushell of Wheat!
But if there is a drought and there will be no Wheat,
the Future is Broken.
defmodule Greeter do
def hello(name) do
"hi #{name}"
end
end
f
input
output
iex(1)> Greeter.hello("world")
"hi world"