What type of Elixir constructs may be used to present a failed process in Elixir ?
What do you mean by a failed process? Those that crash? They are gone. No need to represent them anymore.
They produced some faulty result they want to report somewhere? Use :error
and :ok
tuples to communicate error and success respectively.
With failed I refer to a process that fails with an error for having received an unexpected message from a mailbox.
How is that a fail? Log and proceed…
It is a fail for the type system I am using. Since that is the only way it can fail.
Then crash. Perhaps send an error to whoever expect to receive a response.
But at the end, it’s up to you how to handle this kind of errors.
Based on this question and some others you have made, I’m going to suggest a slightly different approach here. Instead of starting with a specific framework or goal, and asking us questions about how Elixir can fit that, start learning Elixir on its own terms. Go through the guides, run the exercises, watch some of the wonderful talks that describe how the BEAM works. Then when you have a sense of how Elixir works, make a thoughtful proposal about how some you think some aspect of this mailbox calculus you have might use some aspect of Elixir. You’ll be able to get much more useful response this way.