devinus/poolboy — pull request #34 by evnu (2013-10-18 12:04:02+00:00)
Title: Convert poolboy_worker to use -callback

The current `poolboy_worker` behaviour makes use of `behavior_info/1`. For more recent versions of Erlang/OTP, using `-callbacks` should be preferred. On my machine (R16B02), dialyzer seems to fail to find the behaviour when `behaviour_info/1` is used.

If backwards compatibility is an issue, using `rebar.config` to set `erl_opts` might be an option. I did not find a good way to do this, but maybe something along the following lines of thought might be useful:

% rebar.config
{erl_opts, [{platform_define, "(R13|R14|..)", 'NO_CALLBACK_SUPPORT'}]}.

% poolboy_worker.erl
-ifndef(NO_CALLBACK_SUPPORT).
-callback [...]
-else.
-export([..]).
[..]
-endif.

Note that the above must use an excessive list of Erlang/OTP versions (including the Bxx subversion). I have not implemented this workaround yet.