Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p><strong>Q:</strong> What an Erlang/OTP beginner should know about behaviours? Is it possible to describe and understand the notion of OTP behaviour in a nutshell?</p> </blockquote> <p>A behaviour is usually used in code so that the compiler can generate more intuitive error messages depending upon its behaviour i.e application/supervisor/gen_server/gen_event/gen_fsm.</p> <p>It enables the compiler give error messages specific to the behaviour for ex: gen_server</p> <blockquote> <p><strong>Q:</strong> What 'callback function' does actually mean in the context of Elang/OTP?</p> </blockquote> <p>Callback function can be said to be taken from GUI programming (at least similar). Whenever an event occurs for ex. a mouse click there is a separate function that handles mouse click.</p> <p>Thus whenever for eg. an exported function of a gen_server is called from another module, that function can have a callback function (handle_call/handle_cast) having different patterns.</p> <blockquote> <p><strong>Q:</strong> Can we consider the callbacks in a behaviour implementation as methods overridden in Java?</p> </blockquote> <p>Yeah...maybe...no :)</p> <blockquote> <p><strong>Q:</strong> 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'.</p> </blockquote> <p>gen_server:start_link calls init function by itself as answered by w55.... (sorry quite a big name).</p> <hr/> <p>Hope I have answered all your queries :)</p>
 

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