Your own behaviours

Vance Shipley <>
Thu Sep 27 14:51:22 CEST 2001


This is an issue I have visited before.  The first time we packaged
an "application" I found it odd that the top module, having behaviour
application, did pretty much nothing but start top level supervisor
which was implemented in another module.  I wondered why the supervisor
couldn't also be the application master.  Looking at the callbacks 
which the two behaviours have I saw no conflict.  Then I looked at
OTP for examples and that is just what I found.  Some notable modules
which behave as both supervisor and application master are kernel
and sasl.

Here is the example from kernel.erl:


I wrote a shell script to find all examples (included below) and
here is the list from R7B-3:



Vance Shipley
Motivity Telecom Inc.
+1 519 579 5816
#! /bin/sh
for i in `find . -name "*.erl"`
        if [ `fgrep -c "behaviour(" $i` -gt 1 ] 
                echo $i

More information about the erlang-questions mailing list