I think I finally understand how and why Elixir handles state in an Agent or GenServer and I want the Elixir experts to chime in to see if I’m right, close to right, or dead wrong. I hope I’m right because if I’m not then I’m completely confused.
Basically Elixir sets up a recursive, tail optimized function which builds up state in its parameter(or a reference to the built up state) and this is the foundation on which the api’s Agent and GenServer sit on…
Also: This recursive, tail optimized function blocks while its waits for its queue/mailbox to receive messages that match clauses in its receive block.
So is this pretty close to the Elixir reality of state in Agents and GenServer?
What an ingenious way to present state to the program… Now I understand all the fuss about processes and available state in an immutable Elixir environment. Thank-you.