<pclass="purpose">Compiling Inter property value instructions for the properties of instances and kinds.</p>
<ulclass="toc"><li><ahref="6-pv.html#SP1">§1. Of instances and kinds</a></li><li><ahref="6-pv.html#SP2">§2. Of subjects</a></li></ul><hrclass="tocbar">
<pclass="commentary firstcommentary"><aid="SP1"class="paragraph-anchor"></a><b>§1. Of instances and kinds. </b>These are the only two functions to call from outside this section:
<spanclass="reserved-syntax">void</span><spanclass="plain-syntax"></span><spanclass="function-syntax">RTPropertyValues::emit_subject</span><buttonclass="popup"onclick="togglePopup('usagePopup3')"><spanclass="comment-syntax">?</span><spanclass="popuptext"id="usagePopup3">Usage of <spanclass="code-font"><spanclass="function-syntax">RTPropertyValues::emit_subject</span></span>:<br/><ahref="6-pv.html#SP1">§1</a></span></button><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">inference_subject</span><spanclass="plain-syntax"> *</span><spanclass="identifier-syntax">subj</span><spanclass="plain-syntax">) {</span>
<spanclass="plain-syntax"></span><spanclass="identifier-syntax">LOGIF</span><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">OBJECT_COMPILATION</span><spanclass="plain-syntax">, </span><spanclass="string-syntax">"Compiling properties for $j\n"</span><spanclass="plain-syntax">, </span><spanclass="identifier-syntax">subj</span><spanclass="plain-syntax">);</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="6-pv.html#SP2_1"class="named-paragraph-link"><spanclass="named-paragraph">Append any inclusions the source text requested</span><spanclass="named-paragraph-number">2.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="identifier-syntax">LOGIF</span><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">OBJECT_COMPILATION</span><spanclass="plain-syntax">, </span><spanclass="string-syntax">"Compilation of $j complete\n"</span><spanclass="plain-syntax">, </span><spanclass="identifier-syntax">subj</span><spanclass="plain-syntax">);</span>
<spanclass="plain-syntax">}</span>
</pre>
<pclass="commentary firstcommentary"><aid="SP2_1"class="paragraph-anchor"></a><b>§2.1. </b>This is an ugly business, but the I7 language supports the injection of raw
Inter code into object bodies. In an ideal world we would revoke this ability;
the Standard Rules do not use it.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Append any inclusions the source text requested</span><spanclass="named-paragraph-number">2.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="6-pv.html#SP2_2_1"class="named-paragraph-link"><spanclass="named-paragraph">Emit the value of this property of the subject</span><spanclass="named-paragraph-number">2.2.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"> }</span>
</pre>
<ulclass="endnotetexts"><li>This code is used in <ahref="6-pv.html#SP2">§2</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP2_3"class="paragraph-anchor"></a><b>§2.3. </b>We now wander through the permitted properties, even those which we have
no actual knowledge about.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Emit permitted but unspecified object properties</span><spanclass="named-paragraph-number">2.3</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="6-pv.html#SP2_2_1"class="named-paragraph-link"><spanclass="named-paragraph">Emit the value of this property of the subject</span><spanclass="named-paragraph-number">2.2.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"> }</span>
<spanclass="plain-syntax"> }</span>
</pre>
<ulclass="endnotetexts"><li>This code is used in <ahref="6-pv.html#SP2">§2</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP2_2_1"class="paragraph-anchor"></a><b>§2.2.1. </b>Either way, then, we end up here. The following works out what initial
value the property will have, and compiles a clause as appropriate.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Emit the value of this property of the subject</span><spanclass="named-paragraph-number">2.2.1</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="6-pv.html#SP2_2">§2.2</a>, <ahref="6-pv.html#SP2_3">§2.3</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP3"class="paragraph-anchor"></a><b>§3. </b>The following provides a mechanism to tell whether we have visited a property
before. (Where visiting an either/or property also visits its negation.) This
ensures that we cannot compile the same property of the same subject twice.
<spanclass="reserved-syntax">void</span><spanclass="plain-syntax"></span><spanclass="function-syntax">RTPropertyValues::begin_traverse</span><buttonclass="popup"onclick="togglePopup('usagePopup4')"><spanclass="comment-syntax">?</span><spanclass="popuptext"id="usagePopup4">Usage of <spanclass="code-font"><spanclass="function-syntax">RTPropertyValues::begin_traverse</span></span>:<br/><ahref="6-pv.html#SP2">§2</a></span></button><spanclass="plain-syntax">(</span><spanclass="reserved-syntax">void</span><spanclass="plain-syntax">) {</span>
<spanclass="reserved-syntax">int</span><spanclass="plain-syntax"></span><spanclass="function-syntax">RTPropertyValues::visited_in_traverse</span><buttonclass="popup"onclick="togglePopup('usagePopup5')"><spanclass="comment-syntax">?</span><spanclass="popuptext"id="usagePopup5">Usage of <spanclass="code-font"><spanclass="function-syntax">RTPropertyValues::visited_in_traverse</span></span>:<br/><ahref="6-pv.html#SP2_2_1">§2.2.1</a></span></button><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">property</span><spanclass="plain-syntax"> *</span><spanclass="identifier-syntax">prn</span><spanclass="plain-syntax">) {</span>
<pclass="commentary firstcommentary"><aid="SP4"class="paragraph-anchor"></a><b>§4. </b>This is a rather annoying provision, like everything to do with Inter
translation. But we don't want to hand the problem downstream to the code
generator; we want to deal with it now. The issue arises with source text like:
</p>
<blockquote>
<p>A keyword is a kind of value. The keywords are xyzzy, plugh. A keyword can be mentioned.</p>
</blockquote>
<pclass="commentary">where "mentioned" is implemented for objects as an attribute in Inter.
</p>
<pclass="commentary">That would make it impossible for the code-generator to store the property
instead in a flat array, which is how it will want to handle properties of
values. There are ways we could fix this, but property lookup needs to be fast,
and it seems best to reject the extra complexity needed.
<spanclass="reserved-syntax">void</span><spanclass="plain-syntax"></span><spanclass="function-syntax">RTPropertyValues::check_kind_can_have_property</span><buttonclass="popup"onclick="togglePopup('usagePopup6')"><spanclass="comment-syntax">?</span><spanclass="popuptext"id="usagePopup6">Usage of <spanclass="code-font"><spanclass="function-syntax">RTPropertyValues::check_kind_can_have_property</span></span>:<br/><ahref="6-pv.html#SP1">§1</a></span></button><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">kind</span><spanclass="plain-syntax"> *</span><spanclass="identifier-syntax">K</span><spanclass="plain-syntax">) {</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="6-pv.html#SP4_1"class="named-paragraph-link"><spanclass="named-paragraph">Bitch about our implementation woes, like it's not our fault</span><spanclass="named-paragraph-number">4.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax">}</span>
</pre>
<pclass="commentary firstcommentary"><aid="SP4_1"class="paragraph-anchor"></a><b>§4.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Bitch about our implementation woes, like it's not our fault</span><spanclass="named-paragraph-number">4.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"Sorry, but I'm going to have to disallow the sentence %1, even "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"though it asks for something reasonable. A very small number "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"of either-or properties with meanings special to Inform, like '%2', "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"are restricted so that only kinds of object can have them. Since "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"%3 isn't a kind of object, it can't be said to be %2. %P"</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"Probably you only need to call the property something else. The "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"built-in meaning would only make sense if it were a kind of object "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"in any case, so nothing is lost. Sorry for the inconvenience, all "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"the same; there are good implementation reasons."</span><spanclass="plain-syntax">);</span>