[erlang-questions] callback module without behavior definition?
Ryan Zezeski
rzezeski@REDACTED
Sat Apr 23 05:34:23 CEST 2011
On Wed, Apr 6, 2011 at 12:46 PM, Daniel Goertzen
<daniel.goertzen@REDACTED>wrote:
> One thing that has bothered me about implementing gen_servers is that I
> have to create empty stubs for the callbacks that I don't need. Today I
> made a gen_server that only needs init/1, so instead of creating all those
> stubs I just commented out the behavior definition "-behavior(gen_server)."
>
>
Daniel,
The _Erlang Programming_ book actually says **not** to implement callbacks
you don't need. (pp274) I think that makes sense and is the advice I have
followed. However, most people tend to implement all the callbacks even if
they don't use them for anything. In fact, I think that's the recommended
way in _OTP in Action_. So it seems not even the veterans can agree on this
topic.
-Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110422/0bd7ced3/attachment.htm>
More information about the erlang-questions
mailing list