[erlang-questions] Re: callback module without behavior definition?
Wed Apr 6 20:50:27 CEST 2011
Yes, it is just a compile-time check and if the undefined callbacks are never called then no errors will occur. Using a gen_server for this case may seem like a bit of an overkill but it does save a bit of programming if you want the process to be "OTP-compliant". Starting it using proc_lib and doing it all yourself is not that difficult and is quite well explained in the Erlang documentation: http://www.erlang.org/doc/design_principles/spec_proc.html.
----- "Andrew Thompson" <andrew@REDACTED> wrote:
> On Wed, Apr 06, 2011 at 01:03:40PM -0500, Daniel Goertzen wrote:
> > I do want to hook it into a supervisor. If I use a proc_lib
> process, it
> > looks like I would have to implement a message loop and some other
> > callbacks.
> > I guess my original question is more about what behavior statements
> > do. Do they just add compile-time "type" checking, or do they have
> > real runtime impact?
> They're only compile-time to my knowledge. However, if you omit the
> methods the behaviour expects, you will get runtime crashes that
> be pretty.
> erlang-questions mailing list
More information about the erlang-questions