Disable compiler warning?

183 views
Skip to first unread message

Steve Pallen

unread,
Apr 8, 2014, 9:53:43 AM4/8/14
to elixir-l...@googlegroups.com
Is there a way to disable the following compiler warning? 

 ' warning: conflicting behaviours - callback handle/1 required by both ...'

Or perhaps there is a better way for me to implement the following:

I need to manage a pool of clients that can connect to my server with both a reliable UDP (read customer stack) and TCP connections. Each client needs to support both, with the RUDP connection coming up first, moving to the TCP connection after the exchange to messages, and using the RUDP connection as a fall back. So, my server needs to maintain the connection state for each client and decide with connection to use for outgoing messages. I don't control the legacy clients :(

I use Reagent for the TCP connections, and created modeled my own Rudp behaviour after Reagent, where the Reagent.start returns the pid of the already started gen_server.  I use both behaviours in the genserver issuing the compiler warning above. I don't see any reason what this should not work, and therefore would like to block the warning. 

Steve

José Valim

unread,
Apr 8, 2014, 10:09:13 AM4/8/14
to elixir-l...@googlegroups.com
You can try:

    @compile :no_warn_conflicting_behaviours

But I am not sure if it will work. Other solutions are:

1. Split the functions in two modules
2. Do not declare one of the behaviours explicitly (like do not add @behaviour :foo)




José Valim
Skype: jv.ptec
Founder and Lead Developer


--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve Pallen

unread,
Apr 8, 2014, 10:52:36 AM4/8/14
to elixir-l...@googlegroups.com, jose....@plataformatec.com.br

    @compile :no_warn_conflicting_behaviours
 
Did not work 


2. Do not declare one of the behaviours explicitly (like do not add @behaviour :foo)
 
 This worked! Thanks

What does the @behaviour really do, if its not needed?

Thanks,
Steve

José Valim

unread,
Apr 8, 2014, 10:55:45 AM4/8/14
to elixir-l...@googlegroups.com
It just checks if you implemented all the callbacks and helps with dialyzer too. The former is useful in case the behaviour adds new callbacks in the future (very unlikely to happen with a gen server at this point).



José Valim
Skype: jv.ptec
Founder and Lead Developer


--
Reply all
Reply to author
Forward
0 new messages