<!--Weave of 'How To Include This Module' generated by Inweb-->
<divclass="breadcrumbs">
<ulclass="crumbs"><li><ahref="../index.html">Home</a></li><li><ahref="../compiler.html">Services</a></li><li><ahref="index.html">kinds</a></li><li><ahref="index.html#P">Preliminaries</a></li><li><b>How To Include This Module</b></li></ul></div>
<pclass="purpose">What to do to make use of the kinds module in a new command-line tool.</p>
<ulclass="toc"><li><ahref="P-htitm.html#SP1">§1. Status</a></li><li><ahref="P-htitm.html#SP2">§2. Importing the module</a></li><li><ahref="P-htitm.html#SP3">§3. Using callbacks</a></li></ul><hrclass="tocbar">
<pclass="commentary firstcommentary"><aid="SP1"></a><b>§1. Status. </b>The kinds module is provided as one of the "services" suite of modules,
which means that it was built with a view to potential incorporation in
multiple tools. It can be found, for example, in <ahref="../inform7/index.html"class="internal">inform7</a> and
<pclass="commentary">By convention, the modules considered as "services" have no dependencies on
other modules except for <ahref="../../../inweb/docs/foundation-module/index.html"class="internal">foundation</a> and other "services" modules.
</p>
<pclass="commentary">A tool can import <ahref="index.html"class="internal">kinds</a> only if it also imports <ahref="../../../inweb/docs/foundation-module/index.html"class="internal">foundation</a>,
<ahref="../words-module/index.html"class="internal">words</a>, <ahref="../syntax-module/index.html"class="internal">syntax</a>, <ahref="../inflections-module/index.html"class="internal">inflections</a> and <ahref="../linguistics-module/index.html"class="internal">linguistics</a>.
</p>
<pclass="commentary firstcommentary"><aid="SP2"></a><b>§2. Importing the module. </b>We'll use the term "parent" to mean the tool which is importing <ahref="index.html"class="internal">kinds</a>,
that is, which will include its code and be able to use it. As with any
imported module,
</p>
<ulclass="items"><li>● The contents page of the parent's web must identify and locate the
<ulclass="items"><li>● The parent must call <ahref="1-km.html#SP3"class="internal">KindsModule::start</a> just after it starts up, and
<ahref="1-km.html#SP3"class="internal">KindsModule::end</a> just before it shuts down. (But just after, and just
before, the corresponding calls to <ahref="../../../inweb/docs/foundation-module/index.html"class="internal">foundation</a>.)
</li></ul>
<pclass="commentary firstcommentary"><aid="SP3"></a><b>§3. Using callbacks. </b>Shared modules like this one are tweaked in behaviour by defining "callback
functions". This means that the parent might provide a function of its own
which would answer a question put to it by the module, or take some action
on behalf of the module: it's a callback in the sense that the parent is
normally calling the module, but then the module calls the parent back to
ask for data or action.
</p>
<pclass="commentary">The parent must indicate which function to use by defining a constant with
a specific name as being equal to that function's name. A fictional example
<ulclass="items"><li>●<spanclass="extract"><spanclass="extract-syntax">HIERARCHY_GET_SUPER_KINDS_CALLBACK</span></span> is called to ask what the superkind
of a kind is. See <ahref="2-kc.html#SP10"class="internal">Kinds::Compare::super</a>.
</li><li>●<spanclass="extract"><spanclass="extract-syntax">HIERARCHY_IS_COMPATIBLE_KINDS_CALLBACK</span></span> is called to ask if one kind