Extending Functionality: gen_server_ext

Chris Pressey cpressey@REDACTED
Wed Mar 19 17:13:27 CET 2003


On Fri, 14 Mar 2003 10:28:23 +0100
"Vlad Dumitrescu (EAW)" <Vlad.Dumitrescu@REDACTED> wrote:

> Hi guys,
> 
> I happen to know this Vlad person :-D and he likes to be the fool that
> throws the stone into the lake and let 20 wise people try for a month
> to figure how to pick it back.
> [... gen_server_ext ...]

Hi Vlad,

I think you're really onto something here (for dynamic behaviour at least,
i.e. when you already know for sure you're going to have a process), I
just wanted to clarify how it works.

First, it occurs to me that I don't know any good term for "module which
implements a behaviour", so I'm going to use "behaver" for better or worse
(sounds a lot like "behaviour" when spoken so I'm open to better
suggestions.)

So - my impression is that, when you write a behaver for gen_server_ext,
you typically code it so that when it receives a message it doesn't
understand, it passes it on to the next behaver with
gen_server_ext:next_*()

The other option open seems to be that any unrecognized message would be
passed along to the next behaver in the chain.  (a bit like gen_event?)

I can see why you would want to go with the first method - it's more
flexible and more explicit/predictable - but I think there are some minor
oddities with it being explicit, too - could you accidentally call
next_cast within a call handler? (then what happens?  Is this "legal"?)

-Chris



More information about the erlang-questions mailing list