[erlang-questions] behaviour X undefined

Ulf Wiger <>
Fri Jun 24 21:29:41 CEST 2011


Actually, it's only one extra parameter…

But it still won't work, since the parameterized module compilation inserts a pattern match, so even if you would write:

behaviour_info() ->
   behaviour_info(callbacks).

behaviour_info(callbacks) ->
   …

this would lead to behaviour_info/1 being exported, but it would look something like this:

behaviour_info({_,Cbk,Context,Modules} = THIS) ->
    behaviour_info(callbacks, THIS).

behaviour_info(callbacks, {_,Cbk,Context,Modules} = THIS) ->
   …

so the linter calling exch:behaviour_info(callbacks) would still fail.

BR,
Ulf W

On 24 Jun 2011, at 15:56, Loïc Hoguin wrote:

> On 06/24/2011 01:53 PM, Joel Reymont wrote:
>> Why is this happening?
>> 
>> make
>> ==> getopt (compile)
>> Compiled src/getopt.erl
>> ==> openpoker (compile)
>> Compiled src/limit.erl
>> Compiled src/exch.erl
>> ...
>> src/tourney.erl:22: Warning: behaviour exch undefined
>> 
>> The top of exch.erl looks like this
>> 
>> -module(exch, [Cbk, Context, Modules]).
> 
> I don't think an evil parameterized module can be used as a behaviour;
> the behaviour_info/1 function will be undefined because you're
> implicitly adding 3 parameters to it.
> 
> -- 
> Loïc Hoguin
> Dev:Extend
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com






More information about the erlang-questions mailing list