Changeset 4431

Show
Ignore:
Timestamp:
08/17/08 10:41:43 (5 months ago)
Author:
pmoura
Message:

Added support for declaring predicate aliases in the use_module/2 directive using the notation Original:Alias.

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/compiler/logtalk.pl

    r4429 r4431  
    59465946    ;   throw(instantiation_error) 
    59475947    ), 
    5948     (   Pred = (Original::Alias) -> 
     5948    (   Pred = ':'(Original, Alias) -> 
    59495949        true 
    59505950    ;   (Original, Alias) = (Pred, Pred) 
  • trunk/manuals/migration/index.html

    r4412 r4431  
    226226As a general rule, the Prolog modules should be loaded (e.g. in the auxiliary Logtalk loader files) before compiling objects that make use of module predicates. This is mandatory whenever the module exports operator declarations that you want to use in your objects and categories (as in the example above). 
    227227</p> 
     228<p> 
     229Logtalk supports the declaration of predicate aliases in <code>use_module/2</code> directives used within object and categories. For example, the ECLiPSe IC Constraint Solvers defines a <code>::/2</code> variable domain operator that clashes with the Logtalk <code>::/2</code> message sending operator. We can solve the conflict by writing: 
     230</p> 
     231<pre>:- use_module(ic, [alldifferent/1, (::)/2:ins/2, (#=)/2]).</pre> 
     232<p> 
     233With this directive, calls to the <code>ins/2</code> predicate alias will be automatically compiled by Logtalk to calls to the <code>::/2</code> predicate in the <code>ic</code> module. 
     234</p> 
    228235 
    229236<div class="footer"> 
    230237    <div class="copyright"> 
    231238        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    232         <span>Last updated on: July 31, 2008</span> 
     239        <span>Last updated on: August 16, 2008</span> 
    233240    </div> 
    234241    <div class="navbottom"> 
  • trunk/RELEASE_NOTES.txt

    r4429 r4431  
    1818    Added support for using Prolog use_module/2 directives in objects and  
    1919    categories. This allows module predicates to be called using implicit  
    20     qualification, improving readability. 
     20    qualification, improving readability. The use_module/2 directive supports 
     21    the declaration of predicate aliases using the notation Original:Alias. 
    2122 
    2223    Added support for meta-calls whose closure arguments are explicitly