I would like to focus on one important common point that I noticed when working with different interfaces for variable attributes: when developing an interface for variable attributes, the developer should also keep in mind the following:
- Is it possible to take attributes into account when discussing simultaneous unifications , as in
[X,Y] = [0,1] ?
This is possible, for example, in SICStus Prolog, since such bindings were canceled before verify_attributes/3 called. In the interface provided by hProlog ( attr_unify_hook/2 , called after unification and with all the attachments already in place), it is difficult to take into account the (previous) attributes of Y when discussing the union of X into attr_unify_hook/2 , because Y no longer a variable at this point ! This may be enough for solvers who can make decisions based only on ground-based values, but this is a serious limitation for solvers who need additional data, usually stored in attributes, to see if the join should succeed, and then no longer Available, One obvious example: logical unification with decision diagrams.
As of 2016, the check-attribute branch in SWI-Prolog also supports verify_attributes/3 , thanks to the great work of doing Douglas Miles . The branch is ready for testing and should be combined with the master as soon as it works correctly and efficiently. For compatibility with hProlog, the branch also supports attr_unify_hook/2 : it does this by overwriting such definitions into a more general verify_attributes/3 at compile time.
It is clear that there may be a drawback of verify_attributes/3 , since the simultaneous creation of several variables can lead to the fact that you will more likely see (in attr_unify_hook/2 ) that the union cannot be performed. However, I will gladly and at any time share this, as a rule, insignificant advantage to increase the reliability, ease of use and enhanced functionality that gives you a more general interface, which in any case is already standard behavior in SICStus Prolog, which located at the top of its community is also one of the faster Prolog systems.
SICStus Prolog also contains an important predicate called project_attributes/2 : it is used toplevel to restrict the project to request variables. SWI-Prolog also supports this in recent versions.
There is also a huge advantage to the SWI: the residual targets that attribute_goals//1 and therefore copy_term/3 give you are always a list. This helps users to avoid default in their code and encourages a more declarative interface because the list of goals of a pure constraint cannot contain management structures.
Interestingly, no interface allows interpreting unifications except syntactically. Personally, I believe that there are cases where you can interpret unifications differently than syntactically, but there may be good arguments against this.
Other interface predicates for assigned variables are in most cases easily interchangeable with simple shell predicates for different systems.