behaviours

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Tue Jul 29 11:59:49 CEST 2003


From: "Fredrik Linder" <fredrik.linder@REDACTED>
> > Just a thought that might open the can of snakes/worms/dragons :
> > I think there
> > is a difference in semantics for the two usages, maybe it would
> > be appropriate
> > to use different keywords? ...
>
> I've thought about that too, but what is the real difference between
> interfaces and behaviours? Is it really possible to differentiate the two?

I think you did put your finger right on the difference:
    * defining different (non-overlapping) roles that a process will implement
    * defining a one-of-several and rather complex basic functionality of a
process

I'm not sure I captured the meaning in those phrases, but it's a start.

Maybe if this interface thing would be pushed to the absurd (or almost there),
then gen_server anf friends would be defined by composing in different ways
several simpler interfaces, for example 'supervisable' (i.e. can be included in
a supervision tree),  'upgradeable', 'callable'... Really hard to do a
meaningful split, so I won't go further :-)

Using interfaces would probably be most useful in environments with plug-in,
dynamic and/or mobile modules - of course one can just use
erlang:function_exported, but my feeling is that having a more abstract view
could allow for further interesting developments.

regards,
Vlad



More information about the erlang-questions mailing list