<font color="#3366ff" face="tahoma, sans-serif">Hi</font><br><br><div class="gmail_quote">On Thu, Oct 25, 2012 at 11:40 AM, Dmitry Kolesnikov <span dir="ltr"><<a href="mailto:dmkolesnikov@gmail.com" target="_blank">dmkolesnikov@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hello,</div><div><br></div><div>you could achieve dynamic behavior through add_handler/add_sup_handler and delete_handler.</div>

<div>The major point here you are re-using existed OTP function. </div></div></blockquote><div><br></div><div>I think you and I have a different understanding of the dynamic behavior I mentioned. By using just one module with the support of callbacks list, I could handle the event without knowing the handler's behavior beforehand. If I use add_handler/add_sup_handler, it will add a lot of callback module into the event manager and the number of handlers is equal to the number of callbacks, even when some callbacks are for the same event type. If I use one module with dynamic callbacks, the number of handlers is equal to the number of event types, and I can support more.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>The requirement to accure all of the state of another event handler might be challenging. </div>

<div>I believe you need to </div><div> a) either execute callback in dedicated process spawn(fun() -> Callback(Payload) end)</div></div></blockquote><div><br></div><div>I am actually going this route.</div><div> </div>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div> b) re-factor your listener concept where event handlers independent. I would propose to follow-up this way.</div>

</div></blockquote><div><br></div><div>I don't think it matters whether event handlers are independent. Event within an even handler, I cannot do gen_event:call to get the state of a different event handler.</div></div>