Quantcast

behaviour X undefined

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

behaviour X undefined

Joel Reymont
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]).
-behaviour(gen_server).

-export([behaviour_info/1]).

-export([init/1, handle_call/3, handle_cast/2,
         handle_info/2, terminate/2, code_change/3]).

And tourney.erl

-module(tourney).
-behaviour(exch).


--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Torben Hoffmann
I think you are missing a path to the beam file for exch when you compile tourney.

Cheers,
Torben

On Fri, Jun 24, 2011 at 13:53, Joel Reymont <[hidden email]> 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]).
-behaviour(gen_server).

-export([behaviour_info/1]).

-export([init/1, handle_call/3, handle_cast/2,
        handle_info/2, terminate/2, code_change/3]).

And tourney.erl

-module(tourney).
-behaviour(exch).


--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



--
http://www.linkedin.com/in/torbenhoffmann

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Joel Reymont

On Jun 24, 2011, at 12:58 PM, Torben Hoffmann wrote:

> I think you are missing a path to the beam file for exch when you compile tourney.

rebar puts all the files into ebin, though.

How do I tell rebar to include ebin during compilation?

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Torben Hoffmann


On Fri, Jun 24, 2011 at 14:07, Joel Reymont <[hidden email]> wrote:

On Jun 24, 2011, at 12:58 PM, Torben Hoffmann wrote:

> I think you are missing a path to the beam file for exch when you compile tourney.

rebar puts all the files into ebin, though.

How do I tell rebar to include ebin during compilation?

No clue - my Emakefiles have special lines for the behaviours that are at the top of the list.

Surely there must be something like that for rebar...

Cheers,
Torben
 

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------






--
http://www.linkedin.com/in/torbenhoffmann

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Torben Hoffmann
Sorry - forgot to post to the list.

On Fri, Jun 24, 2011 at 14:37, Torben Hoffmann <[hidden email]> wrote:


On Fri, Jun 24, 2011 at 14:16, ERLANG <[hidden email]> wrote:
Hi Torben,


No clue - my Emakefiles have special lines for the behaviours that are at the top of the list.



Could you please share one of your Emakefile for learning?

Thanks
Zab





--
http://www.linkedin.com/in/torbenhoffmann

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Joel Reymont
In reply to this post by Torben Hoffmann

On Jun 24, 2011, at 12:58 PM, Torben Hoffmann wrote:

> I think you are missing a path to the beam file for exch when you compile tourney.

Trying by hand...

erlc -I ../include -pa ../ebin tourney.erl
./tourney.erl:22: Warning: behaviour exch undefined

ls ../ebin/exch.beam
../ebin/exch.beam

erlc -I ../include -I ../ebin -pa ../ebin tourney.erl
./tourney.erl:22: Warning: behaviour exch undefined

Still doesn't work. Why?

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Loïc Hoguin
In reply to this post by Joel Reymont
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
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Joel Reymont

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

> 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.

Bummer! :-(

It seems to work otherwise, though, in all aspects but the compilation warning.

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Torben Hoffmann


On Fri, Jun 24, 2011 at 15:59, Joel Reymont <[hidden email]> wrote:

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

> 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.

Bummer! :-(

It seems to work otherwise, though, in all aspects but the compilation warning.

I just tried to simulate what you were doing with a non-parameterised module and it works like a charm, so this is probably the reason.

Cheers,
Torben
 

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________



--
http://www.linkedin.com/in/torbenhoffmann

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: behaviour X undefined

Ulf Wiger
In reply to this post by Loïc Hoguin

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
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions

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



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...