behaviours

Fredrik Linder fredrik.linder@REDACTED
Tue Jul 29 13:11:00 CEST 2003


> From: owner-erlang-questions@REDACTED
> [mailto:owner-erlang-questions@REDACTED]On Behalf Of Vlad Dumitrescu
>
> 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.

Yeah, maybe. I'm didn't really grasp that either. :-)

> 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 :-)

Yes, wouldn't this be great? :-)

But then again (back to behaviours vs. interfaecs), by just making a small
shift of view these new simpler interfaces becomes behaviours, since they
too can be implemented having different behaviours. (Each interface having
1+ implementations, each having a different behaviour).

> 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.

This is my feeling too.

Regards
/Fredrik




More information about the erlang-questions mailing list