keeping gen_server2 optional
Tim Fletcher
mail@REDACTED
Wed Mar 31 10:48:03 CEST 2010
More projects are starting to "bundle" gen_server2, e.g.,
http://github.com/cstar/erldis/blob/master/src/gen_server2.erl
http://github.com/erlyvideo/erlyvideo/blob/master/src/gen_server2.erl
http://hg.basho.com/riak/src/tip/apps/riak/src/gen_server2.erl
I don't dispute the benefits of the gen_server2 changes, but library
developers shouldn't have to include it in every project, and
application developers/users should have the freedom to choose whether
to use it (or not).
>From what I can tell (using diff), gen_server2 makes no changes to the
gen_server API, in which case gen_server:call etc should work just
fine with gen_server2 processes, and there is no benefit in changing
these references to gen_server2:call etc. Is this correct?
The stdlib gen_server implementation can be completely replaced at
load time using another module with the same name. Using gen_server2
selectively may require a little more work, but should just involve
changing gen_server:start_link calls to gen_server2:start_link. Should
this just be left to the end application developer?
More generally, is there a "recommended" mechanism for providing
alternate implementations of a module whilst keeping the same
interface?
More information about the erlang-questions
mailing list