behaviours

Richard Carlsson richardc@REDACTED
Tue Jul 29 15:59:55 CEST 2003


On Tue, 29 Jul 2003, Vlad Dumitrescu wrote:

> You are partly right. I am somewhat confused about the terms, but I
> hope now I managed to clear up my thoughts.
>
> Interface = specification of exported functions for a module
>
> Behaviour = specification of callback functions that are used together
> with a generic "main loop" to define the functionality of a process
>
> That's how I would like to see things, and then there is a difference
> between the two. Does it make sense?

It could make sense, as in "a behaviour is an interface to an
agent/process", making a distinction between passive and active.

I can't quite see the usefulness of this, though, unless the compiler
can be made to actually test properties such as "calling this interface
function will return in constant time" (all computational results are
passed as messages), or "interface functions do not modify the process
state (e.g. the dictionary) of the caller".

It might actually be better to use "-interface(...)" in programs, and
reserve "behaviour" for the latter meaning, but only informally (at
least until we have a better idea of how it can be formalized).

	/Richard


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham



More information about the erlang-questions mailing list