aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/doc
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2017-04-06 16:09:38 +0200
committerRaimo Niskanen <[email protected]>2017-04-20 15:51:26 +0200
commitd30cae56d82763681b633cba25ad553eb672ec16 (patch)
treed54c1ae6f5a7535e01f4085e9d743309ae47ddeb /lib/stdlib/doc
parent8caa54fc05e381a3d321cd48770e48853ddb177a (diff)
downloadotp-d30cae56d82763681b633cba25ad553eb672ec16.tar.gz
otp-d30cae56d82763681b633cba25ad553eb672ec16.tar.bz2
otp-d30cae56d82763681b633cba25ad553eb672ec16.zip
Make Module:init/1 mandatory
Diffstat (limited to 'lib/stdlib/doc')
-rw-r--r--lib/stdlib/doc/src/gen_statem.xml17
1 files changed, 10 insertions, 7 deletions
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 <c>gen_statem</c> engine
branches depending on state name.
- Notice the fact that there is a mandatory callback function
+ Note the fact that the callback function
<seealso marker="#Module:terminate/3"><c>Module:terminate/3</c></seealso>
makes the state name <c>terminate</c> unusable in this mode.
</p>
@@ -1704,7 +1704,7 @@ handle_event(_, _, State, Data) ->
<func>
<name>Module:init(Args) -> Result(StateType)</name>
<fsummary>
- Optional function for initializing process and internal state.
+ Initializing process and internal state.
</fsummary>
<type>
<v>Args = term()</v>
@@ -1720,7 +1720,7 @@ handle_event(_, _, State, Data) ->
<seealso marker="#start_link/3"><c>start_link/3,4</c></seealso>
or
<seealso marker="#start/3"><c>start/3,4</c></seealso>,
- 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.
</p>
<p>
@@ -1729,13 +1729,16 @@ handle_event(_, _, State, Data) ->
</p>
<note>
<p>
- This callback is optional, so a callback module does not need
- to export it, but most do. If this function is not exported,
- the <c>gen_statem</c> should be started through
+ Note that if the <c>gen_statem</c> is started trough
<seealso marker="proc_lib"><c>proc_lib</c></seealso>
and
- <seealso marker="#enter_loop/4"><c>enter_loop/4-6</c></seealso>.
+ <seealso marker="#enter_loop/4"><c>enter_loop/4-6</c></seealso>,
+ this callback will never be called.
+ Since this callback is not optional it can
+ in that case be implemented as:
</p>
+ <pre>
+init(Args) -> erlang:error(not_implemented, [Args]).</pre>
</note>
</desc>
</func>