Per Bergqvist per@REDACTED
Mon Jul 28 07:54:04 CEST 2003

> "Per Bergqvist", <per@REDACTED>, wrote:
> > some questions regarding behaviours
> > 
> > 1) a few modules requests multiple behaviours.
> >    what is the purpose of this ?
> Laziness.  ;-)
> You can, for example, combine gen_server and gen_event,
> or gen_server and supervisor in one module, but this tricks
> the linter, confuses the reader, and is in general a bad idea IMO.

Agree that it is a bad idea in general. 
However, it does not trick the linter. Linter checks for all callback
properly. The only thing is that it emits the warning for several
Reworked my lint patch a bit to support yet another compile option.
When this version the several behaviour may be supressed by

-compile({several_behaviours, [application, supervisor]}).


erlc -W +several_behaviours foo.erl
erlc -W +'{several_behaviours, [application, supervisor]}' foo.erl

> > 2) in megaco and mnesia user defined behaviours are requested
> >    but the target modules does not define the behaviour_info.
> >    why ?
> Back in the old days, you could not define your own behaviour
> without hacking some OTP code. I vaguely recall mnesia providing
> a "quasi behaviour", which wasn't really a known behaviour, but 
> well could have been.
> My guess is that the behaviour_info/1 function has not been added
> yet, since the option to do so is a fairly recent addition.

Still don't see why one would like to use a -behaviour if there 
is no underlying support for it. It will basically be a no-op except
for the warning. Am I missing something ?

> /Uffe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: erl_lint.patch_2
Type: application/octet-stream
Size: 2556 bytes
Desc: not available
URL: <>

More information about the erlang-questions mailing list