Erlang Language Behaviours Using a behaviour


Add a -behaviour directive to your module to indicate that it follows a behaviour:


The American spelling is also accepted:


Now the compiler will give a warning if you've forgotten to implement and export any of the functions required by the behaviour, e.g.:

foo.erl:2: Warning: undefined callback function init/1 (behaviour 'gen_server')