[erlang-questions] multiple behaviours
Wed Jun 6 14:13:30 CEST 2012
> I am compiling the canopen stack (git://github.com/tonyrog/canopen.git) and
> get the following warning:
> ../src/co_os_app.erl:37: Warning: conflicting behaviours - callback
> index_specification/2 required by both 'co_stream_app' and 'co_app' (line
> The question is:
And no question followed ;)
Ideally you could suppress the warning as you really intend to share
the same function for both behaviours, but as far as I know there is
not such an option in the compiler, so you either suppress all
warnings for that module or learn to live with this one.
Or, as you also suggest, write a new behaviour combining those two. If
this situation is not common in your design I would suggest this
solution as prevents you from going against what I think is the
intended use of behaviours. I guess the original idea was to have at
most a behaviour per module, but more authoritative voices may have a
word about this.
If you was planning to have many of those behaviour combinations, the
second option seems bad idea, as the result could be messy.
More information about the erlang-questions