From d30cae56d82763681b633cba25ad553eb672ec16 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen
Date: Thu, 6 Apr 2017 16:09:38 +0200
Subject: Make Module:init/1 mandatory
---
lib/stdlib/doc/src/gen_statem.xml | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
(limited to 'lib/stdlib/doc')
diff --git a/lib/stdlib/doc/src/gen_statem.xml b/lib/stdlib/doc/src/gen_statem.xml
index 5eb13db1aa..f7baaad5d1 100644
--- a/lib/stdlib/doc/src/gen_statem.xml
+++ b/lib/stdlib/doc/src/gen_statem.xml
@@ -146,7 +146,7 @@ erlang:'!' -----> Module:StateName/3
This gathers all code for a specific state
in one function as the gen_statem engine
branches depending on state name.
- Notice the fact that there is a mandatory callback function
+ Note the fact that the callback function
Module:terminate/3
makes the state name terminate unusable in this mode.
@@ -1704,7 +1704,7 @@ handle_event(_, _, State, Data) ->
Module:init(Args) -> Result(StateType)
- Optional function for initializing process and internal state.
+ Initializing process and internal state.
Args = term()
@@ -1720,7 +1720,7 @@ handle_event(_, _, State, Data) ->
start_link/3,4
or
start/3,4,
- this optional function is called by the new process to initialize
+ this function is called by the new process to initialize
the implementation state and server data.
@@ -1729,13 +1729,16 @@ handle_event(_, _, State, Data) ->
- This callback is optional, so a callback module does not need
- to export it, but most do. If this function is not exported,
- the gen_statem should be started through
+ Note that if the gen_statem is started trough
proc_lib
and
- enter_loop/4-6.
+ enter_loop/4-6,
+ this callback will never be called.
+ Since this callback is not optional it can
+ in that case be implemented as:
+
+init(Args) -> erlang:error(not_implemented, [Args]).
--
cgit v1.2.3