Changeset 4530 for trunk/manuals

Show
Ignore:
Timestamp:
10/22/08 11:13:41 (3 months ago)
Author:
pmoura
Message:

Minor documentation improvements.

Location:
trunk/manuals/userman
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/manuals/userman/categories.html

    r4528 r4530  
    180180<pre>:- dynamic.</pre> 
    181181<p> 
    182 The directive must precede any predicate directives or clauses. Please be aware that using dynamic code implies a performance hit when compared to static code. We should only use dynamic categories when these need to be abolished during program execution. 
     182The directive must precede any predicate directives or clauses. Please be aware that using dynamic code results in a performance hit when compared to static code. We should only use dynamic categories when these need to be abolished during program execution. 
    183183</p> 
    184184 
     
    343343:- end_object.</pre> 
    344344<p> 
    345 This alternative should only be used when the user knows a priori that the category predicates will not be specialized or redefined by descendant objects of the object importing the category. Its advantage is that, whenever possible, the Logtalk compiler will optimize the calls by using static binding (implies separate loading of the categories using the <code>reload(skip)</code> compiler flag). However, when static binding is not possible due to the lack of sufficient information at compilation time, the performance may be worse than calling the category predicate using a message to <em>self</em> due to the lack of a caching mechanism. 
     345This alternative should only be used when the user knows a priori that the category predicates will not be specialized or redefined by descendant objects of the object importing the category. Its advantage is that, whenever possible, the Logtalk compiler will optimize the calls by using static binding (requires separate loading of the categories using the <code>reload(skip)</code> compiler flag). However, when static binding is not possible due to the lack of sufficient information at compilation time, the performance may be worse than calling the category predicate using a message to <em>self</em> due to the lack of a caching mechanism. 
    346346</p> 
    347347 
  • trunk/manuals/userman/events.html

    r4195 r4530  
    132132 
    133133<p> 
    134 Ideally, whenever there are several monitors defined for the same event, the calling order should not interfere with the result. However, this is not always possible. In the case of an event of type <code>before</code>, the failure of a monitor prevents a message from being sent and prevents the execution of the remaining monitors. In case of an event of type <code>after</code>, a monitor failure will force backtracking over message execution. Different orders of monitor activation can therefore lead to different results if the monitor actions imply object modifications unrecoverable in case of backtracking. Therefore, the order for monitor activation must be always taken as arbitrary. In effect, to suppose or to try to impose a specific sequence implies a global knowledge of an application dynamics, which is not always possible. Furthermore, that knowledge can reveal itself as incorrect if there is any changing in the execution conditions. Note that, given the independence between monitors, it does not make sense that a failure forces backtracking over the actions previously executed. 
     134Ideally, whenever there are several monitors defined for the same event, the calling order should not interfere with the result. However, this is not always possible. In the case of an event of type <code>before</code>, the failure of a monitor prevents a message from being sent and prevents the execution of the remaining monitors. In case of an event of type <code>after</code>, a monitor failure will force backtracking over message execution. Different orders of monitor activation can therefore lead to different results if the monitor actions imply object modifications unrecoverable in case of backtracking. Therefore, the order for monitor activation must be always taken as arbitrary. In effect, to assume or to try to impose a specific sequence requires a global knowledge of an application dynamics, which is not always possible. Furthermore, that knowledge can reveal itself as incorrect if there is any changing in the execution conditions. Note that, given the independence between monitors, it does not make sense that a failure forces backtracking over the actions previously executed. 
    135135</p> 
    136136 
     
    248248    <div class="copyright"> 
    249249        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    250         <span>Last updated on: April 8, 2007</span> 
     250        <span>Last updated on: October 20, 2008</span> 
    251251    </div> 
    252252    <div class="navbottom"> 
  • trunk/manuals/userman/installing.html

    r4368 r4530  
    188188<dl> 
    189189    <dt><code>multifile_directive</code></dt> 
    190         <dd>Informs Logtalk if the Prolog compiler supports the ISO Prolog standard <code>multifile/1</code> predicate directive. Possible flag values are <code>unsupported</code> and <code>supported</code> (implies that multifile directives can be either static or dynamic).</dd> 
     190        <dd>Informs Logtalk if the Prolog compiler supports the ISO Prolog standard <code>multifile/1</code> predicate directive. Possible flag values are <code>unsupported</code> and <code>supported</code> (requires that multifile predicates can be either static or dynamic).</dd> 
    191191</dl> 
    192192<dl> 
     
    226226    <div class="copyright"> 
    227227        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    228         <span>Last updated on: July 13, 2008</span> 
     228        <span>Last updated on: October 20, 2008</span> 
    229229    </div> 
    230230    <div class="navbottom"> 
  • trunk/manuals/userman/objects.html

    r4511 r4530  
    318318<pre>:- dynamic.</pre> 
    319319<p> 
    320 The directive must precede any predicate directives or clauses. Please be aware that using dynamic code implies a performance hit when compared to static code. We should only use dynamic objects when these need to be abolished during program execution. In addition, note that we can declare and define dynamic predicates within a static object. 
     320The directive must precede any predicate directives or clauses. Please be aware that using dynamic code results in a performance hit when compared to static code. We should only use dynamic objects when these need to be abolished during program execution. In addition, note that we can declare and define dynamic predicates within a static object. 
    321321</p> 
    322322 
     
    443443    <div class="copyright"> 
    444444        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    445         <span>Last updated on: October 17, 2008</span> 
     445        <span>Last updated on: October 20, 2008</span> 
    446446    </div> 
    447447    <div class="navbottom"> 
  • trunk/manuals/userman/predicates.html

    r4497 r4530  
    166166When the same operators are used on several entities within the same source file, the corresponding directives must appear before any entity that uses them. However, this results in a global scope for the operators. If you prefer the operators to be local to the source file, just <em>undefine</em> them at the end of the file. For example: 
    167167</p> 
    168 <pre>:- op(400, xfx, implies).  % before any entity that uses the operator 
     168<pre>:- op(400, xfx, results).  % before any entity that uses the operator 
    169169 
    170170... 
    171171 
    172 :- op(0, xfx, implies).    % after all entities that used the operator</pre> 
     172:- op(0, xfx, results).    % after all entities that used the operator</pre> 
    173173 
    174174<h3 id="predicates_uses">Uses directive</h3> 
     
    519519yes</pre> 
    520520<p> 
    521 Note that the goals <code>self(Self)</code>, <code>sender(Sender)</code>, and <code>this(This)</code>, being translated to unifications with the clause head context arguments at compile time, are effectively removed from the clause body. This implies that a clause such as: 
     521Note that the goals <code>self(Self)</code>, <code>sender(Sender)</code>, and <code>this(This)</code>, being translated to unifications with the clause head context arguments at compile time, are effectively removed from the clause body. Therefore, a clause such as: 
    522522</p> 
    523523<pre>predicate(Arg) :- 
     
    548548yes</pre> 
    549549<p> 
    550 The method <code>parameter/2</code> is only translated to a compile time unification when used inside objects with its first argument instantiated at compile time. When the first argument is not known at compile time, or when the method is used inside categories, its call implies a call to the built-in Prolog predicate <code>arg/3</code>. Nevertheless, note that calls to <code>parameter/2</code> from inside categories are inherently problematic: a category may be implemented by several objects, both parametric (with different number of parameters) and non-parametric. Care must be taken to ensure that a parametric object importing such a category match the interpretation of its parameters used in the category. 
     550The method <code>parameter/2</code> is only translated to a compile time unification when used inside objects with its first argument instantiated at compile time. When the first argument is not known at compile time, or when the method is used inside categories, its call results in a call to the built-in Prolog predicate <code>arg/3</code>. Nevertheless, note that calls to <code>parameter/2</code> from inside categories are inherently problematic: a category may be implemented by several objects, both parametric (with different number of parameters) and non-parametric. Care must be taken to ensure that a parametric object importing such a category match the interpretation of its parameters used in the category. 
    551551</p> 
    552552 
     
    620620</p> 
    621621<p> 
    622 The predicate property <code>defined_in(Entity)</code> implies that definitions for the predicate are looked up in <code>Entity</code>. This does not necessarily implies that clauses for the predicate exist in <code>Entity</code>; the predicate can simply be false (closed world assumption). 
     622The predicate property <code>defined_in(Entity)</code> results in the definitions for the predicate being looked up in <code>Entity</code>. This does not necessarily implies that clauses for the predicate exist in <code>Entity</code>; the predicate can simply be false (closed world assumption). 
    623623</p> 
    624624<p> 
     
    679679    <div class="copyright"> 
    680680        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    681         <span>Last updated on: October 11, 2008</span> 
     681        <span>Last updated on: October 20, 2008</span> 
    682682    </div> 
    683683    <div class="navbottom"> 
  • trunk/manuals/userman/protocols.html

    r4529 r4530  
    125125<pre>:- dynamic.</pre> 
    126126<p> 
    127 The directive must precede any predicate directives. Please be aware that using dynamic code implies a performance hit when compared to static code. We should only use dynamic protocols when these need to be abolished during program execution. 
     127The directive must precede any predicate directives. Please be aware that using dynamic code results in a performance hit when compared to static code. We should only use dynamic protocols when these need to be abolished during program execution. 
    128128</p> 
    129129 
  • trunk/manuals/userman/running.html

    r4524 r4530  
    139139    <dl> 
    140140        <dt><code>xmldir(Directory)</code></dt> 
    141             <dd>Sets the directory to be used to store the automatically generated XML documenting files. The default value is <code>xml_docs</code>, a sub-directory of the source files directory. Use of this flag implies that the read-only flag <code>altdirs</code> be set to <code>on</code> (not supported in some back-end Prolog compilers).</dd> 
     141            <dd>Sets the directory to be used to store the automatically generated XML documenting files. The default value is <code>xml_docs</code>, a sub-directory of the source files directory. Use of this flag requires that the read-only flag <code>altdirs</code> be set to <code>on</code> (not supported in some back-end Prolog compilers).</dd> 
    142142    </dl> 
    143143    <dl> 
     
    194194    <dl> 
    195195        <dt><code>tmpdir(Directory)</code></dt> 
    196             <dd>Sets the directory to be used to store the temporary files generated when compiling Logtalk source files. The default value is <code>lgt_tmp</code>, a sub-directory of the source files directory. Use of this flag implies that the read-only flag <code>altdirs</code> be set to <code>on</code> (not supported in some back-end Prolog compilers).</dd> 
     196            <dd>Sets the directory to be used to store the temporary files generated when compiling Logtalk source files. The default value is <code>lgt_tmp</code>, a sub-directory of the source files directory. Use of this flag requires that the read-only flag <code>altdirs</code> be set to <code>on</code> (not supported in some back-end Prolog compilers).</dd> 
    197197    </dl> 
    198198 
     
    200200 
    201201<p> 
    202 As a general rule, reloading source files should never occur in production code and should be handled with care in development code. Reloading a Logtalk source file usually implies reloading the intermediate Prolog file that is generated by the Logtalk compiler. The problem is that there is no standard behavior for reloading Prolog files. For static predicates, almost all Prolog compilers replace the old definitions with the new ones. However, for dynamic predicates, the behavior depends on the Prolog compiler. Most compilers replace the old definitions but some of them simply append the new ones, which usually leads to trouble. See the compatibility notes for the back-end Prolog compiler you intend to use for more information. There is an additional potential problem when using multi-threading programming. Reloading a threaded object does not recreate from scratch its old message queue, which may still be in use (e.g. threads may be waiting on it). 
     202As a general rule, reloading source files should never occur in production code and should be handled with care in development code. Reloading a Logtalk source file usually requires reloading the intermediate Prolog file that is generated by the Logtalk compiler. The problem is that there is no standard behavior for reloading Prolog files. For static predicates, almost all Prolog compilers replace the old definitions with the new ones. However, for dynamic predicates, the behavior depends on the Prolog compiler. Most compilers replace the old definitions but some of them simply append the new ones, which usually leads to trouble. See the compatibility notes for the back-end Prolog compiler you intend to use for more information. There is an additional potential problem when using multi-threading programming. Reloading a threaded object does not recreate from scratch its old message queue, which may still be in use (e.g. threads may be waiting on it). 
    203203</p> 
    204204<p> 
  • trunk/manuals/userman/threads.html

    r4389 r4530  
    168168</pre> 
    169169<p> 
    170 The call succeeds with no reply of the goal success, failure, or even exception ever being sent back to the object making the call. Note that this predicate implicitly implies a deterministic call of its argument. 
     170The call succeeds with no reply of the goal success, failure, or even exception ever being sent back to the object making the call. Note that this predicate implicitly performs a deterministic call of its argument. 
    171171</p> 
    172172 
     
    174174 
    175175<p> 
    176 Proving a goal asynchronously using a new thread may lead to problems when the goal implies side-effects such as input/output operations or modifications to an object database. For example, if a new thread is started with the same goal before the first one finished its job, we may end up with mixed output, a corrupted database, or unexpected goal failures. In order to solve this problem, predicates (and grammar rule non-terminals) with side-effects can be declared as <em>synchronized</em> by using the <a title="Consult reference manual" href="../refman/directives/synchronized1.html"><code>synchronized/1</code></a> predicate directive. Proving a query to a synchronized predicate (or synchronized non-terminal) is internally protected by a mutex, thus allowing for easy thread synchronization. For example: 
     176Proving a goal asynchronously using a new thread may lead to problems when the goal results in side-effects such as input/output operations or modifications to an object database. For example, if a new thread is started with the same goal before the first one finished its job, we may end up with mixed output, a corrupted database, or unexpected goal failures. In order to solve this problem, predicates (and grammar rule non-terminals) with side-effects can be declared as <em>synchronized</em> by using the <a title="Consult reference manual" href="../refman/directives/synchronized1.html"><code>synchronized/1</code></a> predicate directive. Proving a query to a synchronized predicate (or synchronized non-terminal) is internally protected by a mutex, thus allowing for easy thread synchronization. For example: 
    177177</p> 
    178178<pre>:- synchronized(db_update/1).   % ensure thread synchronization 
     
    254254    <div class="copyright"> 
    255255        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    256         <span>Last updated on: July 20, 2008</span> 
     256        <span>Last updated on: October 20, 2008</span> 
    257257    </div> 
    258258    <div class="navbottom">