behaviours

Thomas Lindgren thomasl_erlang@REDACTED
Mon Jul 28 17:32:02 CEST 2003


--- Fredrik Linder <fredrik.linder@REDACTED>
wrote:

> Imho I do not think this is the way to go, since if
> the actual
> behaviour-definition changes when running the system
> (horrible but
> possible), then each module flagged to fulfill the
> requirements for that
> behaviour needs to re-evaluate it's compliance to
> that behaviour.

That might be an argument for versioning of
behaviours, I think. (In principle, the same is true
today, except there is no notification that it
happened.) 

Though perhaps no notification is needed either? (Or
one could write an extension of code.erl that does
such checking.)

Anyway, Getting It Right might take some thought. What
I had in mind was basically

has_behaviour(M, B) ->
  lists:member(B, M:module_info(behaviours)).

and the compiler tracking what behaviours were
declared in M and putting them in the module_info.
Then the programmers can insert checks that M has the
right behaviour when they write a behaviour, for
example, checking before a server is started.

Best,
Thomas



__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the erlang-questions mailing list