extending standard behaviours

Chris Pressey cpressey@REDACTED
Tue Apr 16 22:33:04 CEST 2002


Vance Shipley wrote:
>On Tue, Apr 16, 2002 at 11:33:00AM -0500, Chris Pressey wrote:
>}  Vance Shipley <vances@REDACTED> wrote:
>}
>}  > What would be the best way to extend standard behaviours?
>}
>}  My initial feeling would be: create another behaviour.
>
>This would amount to copying the entire gen_fsm.erl module to
>my_gen_fsm.erl and adding in a few lines of code.   This seems
>pretty ugly to me.

No copying involved - either you misunderstood me, or I misstated.

Your behaviour extension would look something like:

  -module(my_fsm).
  -behaviour(gen_fsm).
  -export( # same as gen_fsm # ).
  # your functions, which are wrappers on top of those in gen_fsm #

And then, any modules which you wish to conform to your extended behaviour
would look like:

  -module(a_specific_fsm).
  -behaviour(my_fsm).
  # whatever #

Chris





More information about the erlang-questions mailing list