gen_fsm

Francesco Cesarini francesco@REDACTED
Fri Jun 22 14:49:35 CEST 2001


Hi,

>  It's firday afternoon and I'm getting a bit impatient with the code (see
> attachment). It's a simple instantiation of the 'gen_fsm' behaviour.
> Could somebody please tell me what I am doing wrong?

you forgot to export your client functions, your states and your call back
functions. Next time you are having problems, start the debugger, trace
compiling the code and then spawn your process.


>  Besides that, I have a more fundamental question:  If I am not
> mistaken, the implementation of gen_fsm implies that one or more
> processes are spawned.

It depends on your implementation and needs. In that you are registering
your process locally, you may only have one instance of it in your node. If you are not registering it, you may have
one or more, and access it with the Pid.


>  My question is whether it is a good idea to keep this issue
 > transparent from the user who is using the behaviour.  Doesn't this
 > influence the performance of his implementation?

When dealing with processes (or behaviors) it is always a good idea to
hide the fact that they are processes in a functional interface. It gives you more freedom when updating and
maintaining the code. Readability and ease of maintenance should always go before performance.

Regards,
Francesco
--
Francesco Cesarini
http://www.erlang-consulting.com




More information about the erlang-questions mailing list