diff options
author | Hans Bolinder <[email protected]> | 2014-03-25 14:08:30 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2014-03-26 11:48:01 +0100 |
commit | 9dfc9857ff5089282f97656fe59012c26ccae52a (patch) | |
tree | fdc255243451d023438c0ea0f827d90c68e2739a /system/doc/design_principles/spec_proc.xml | |
parent | 97039a7b78cfcb42bfcd86bc97490ea28df37603 (diff) | |
download | otp-9dfc9857ff5089282f97656fe59012c26ccae52a.tar.gz otp-9dfc9857ff5089282f97656fe59012c26ccae52a.tar.bz2 otp-9dfc9857ff5089282f97656fe59012c26ccae52a.zip |
refman: Clarify the '-callback' attribute
Diffstat (limited to 'system/doc/design_principles/spec_proc.xml')
-rw-r--r-- | system/doc/design_principles/spec_proc.xml | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/system/doc/design_principles/spec_proc.xml b/system/doc/design_principles/spec_proc.xml index 69bf2e0448..e4fb5fdca7 100644 --- a/system/doc/design_principles/spec_proc.xml +++ b/system/doc/design_principles/spec_proc.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1997</year><year>2013</year> + <year>1997</year><year>2014</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -431,11 +431,11 @@ loop(...) -> <section> <title>User-Defined Behaviours</title> - <p>To implement a user-defined behaviour, write code similar to + <p><marker id="behaviours"/>To implement a user-defined behaviour, write code similar to code for a special process but calling functions in a callback module for handling specific tasks.</p> <p>If it is desired that the compiler should warn for missing callback - functions, as it does for the OTP behaviours, add callback attributes in the + functions, as it does for the OTP behaviours, add <c>-callback</c> attributes in the behaviour module to describe the expected callbacks:</p> <code type="none"> -callback Name1(Arg1_1, Arg1_2, ..., Arg1_N1) -> Res1. @@ -445,15 +445,15 @@ loop(...) -> <p>where <c>NameX</c> are the names of the expected callbacks and <c>ArgX_Y</c>, <c>ResX</c> are types as they are described in Specifications for functions in <seealso marker="../reference_manual/typespec">Types and - Function Specifications</seealso>. The whole syntax of spec attributes is - supported by callback attributes.</p> + Function Specifications</seealso>. The whole syntax of <c>-spec</c> attribute is + supported by <c>-callback</c> attribute.</p> <p>Alternatively you may directly implement and export the function:</p> <code type="none"> behaviour_info(callbacks) -> - [{Name1,Arity1},...,{NameN,ArityN}].</code> - <p>where each <c>{Name,Arity}</c> specifies the name and arity of a callback + [{Name1, Arity1},...,{NameN, ArityN}].</code> + <p>where each <c>{Name, Arity}</c> specifies the name and arity of a callback function. This function is otherwise automatically generated by the compiler - using the callback attributes.</p> + using the <c>-callback</c> attributes.</p> <p>When the compiler encounters the module attribute <c>-behaviour(Behaviour).</c> in a module <c>Mod</c>, it will call <c>Behaviour:behaviour_info(callbacks)</c> and compare the result with the |