Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>What an Erlang/OTP beginner should know about behaviours?</p> </blockquote> <p>Probably what's written <a href="http://www.erlang.org/doc/design_principles/des_princ.html#id57702" rel="noreferrer">here</a>.</p> <blockquote> <p>Is it possible to describe and understand the notion of OTP behaviour in a nutshell?</p> </blockquote> <p>Reading from the doc: "Behaviours are formalizations of these common patterns. The idea is to divide the code for a process in a generic part (a behaviour module) and a specific part (a callback module)."</p> <blockquote> <p>What 'callback function' does actually mean in the context of Elang/OTP?</p> </blockquote> <p>Look at the link above where examples of callback functions are provided.</p> <blockquote> <p>Can we consider the callbacks in a behaviour implemenation as methods overriden in Java?</p> </blockquote> <p>In Java terms, a behaviour would probably be a Java Interface, while a callback would be the implementation of one of the methods defined in the interface.</p> <blockquote> <p>The book says that the associated callback function for the library function 'gen_server:start_link/4' in the following code is 'Module:init/1'. Does that mean that with init/1 we call the gen_server:start_link/4 library function? Or does that mean anything else?</p> </blockquote> <p>It means that, every time you call the gen_server:start_link/4, the function Module:init/1 will be called, where Module is the second parameter you passed to the start_link function, with the arguments you provided as the forth argument. In other words, this is what happens behind the scenes of the start_link/4:</p> <pre><code>... start_link(Name, Module, Args, Opts) -&gt; ... Module:init(Args) ... ... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload