[erlang-questions] hierarchical behaviour doesn't seem to work ?
Wed Dec 14 08:55:40 CET 2011
I wrote a howto article on this a few years ago:
On Tue, Dec 13, 2011 at 06:37:51PM +0100, Harald Welte wrote:
} However, now if the runtime delivers something like a gen_server method
} such as gen_cast/gen_call, etc., it tries to call client:handle_cast()
} instead of the my_behaviour:handle_cast(). And since
} client:handle_cast() is not defined, it will crash the process.
Yes, you need to define these functions in your module. Your
client may extend these itself and/or pass them on to my_bahaviour.
} Is this really the intended behaviour (sic) of behaviour?
} To me, it seems most logical that you would want to implement levels of
} common functionality in a behaviour, and "sub-class" a number of different
} implementations off such a behaviour. And since all of it should be OTP
} compliant, that custom behaviour itself would be based on some OTP
} behaviour like gen_server, gen_fsm, etc.
} Any comments? Am I misunderstanding something here? Thanks!
Cascading behaviours wasn't anticipated in the design and, aside
from me, very few people have used that design pattern.
More information about the erlang-questions