[erlang-questions] Best practices in gen_fsm usage

Max Lapshin max.lapshin@REDACTED
Wed Dec 7 09:06:43 CET 2011


On Wed, Dec 7, 2011 at 10:49 AM, Thomas Lindgren
<thomasl_erlang@REDACTED> wrote:
>>________________________________

> Regarding points 1 and 2: My favorite approach to using gen_fsm, gen_server etc is to define all the calls to the server/fsm/... as an API, often in the server module itself. The client then just uses these API functions, while it's the job of the provider module to wrangle the raw gen_* calls.
>


Your solution doesn't work in real life. I pass pid of process to the
handler, that makes gen_server calls (through some wrapper) and while
this process is gen_server, I get duck typing and everything works. If
process is gen_fsm, that this schema breaks and I need to pass
explicit type of this process: module where to call wrappers from.

Everything is going to be very complicated, but I refuse and delete
gen_fsm as useless code.



More information about the erlang-questions mailing list