扩展统一,SICStus 风格

Extending unification, SICStus-style

我想了解 SICStus 风格的可扩展统一。 User's Manual on library(atts) 指出:

Module:verify_attributes(-Var, +Value, -Goals) hook

...
verify_attributes/3 may invoke arbitrary Prolog goals, but Var should not be bound by it. Binding Var will result in undefined behavior.
...
In the case when a single unification binds multiple attributed variables, first all such bindings are undone, then the following actions are carried out for each relevant variable:

  1. For each relevant module M, M:verify_attributes/3 is called, collecting a list of returned Goals.
  2. The variable binding is redone.
  3. Any Goals are called.
  4. Any goals blocked on the variable, that has now become unblocked, are called.

到目前为止,我对上面的内容有以下解释:

我的方向是否正确——这个完成,然后撤消,然后重做”是什么意思? 请帮忙!

该机制最初由 Christian Holzbaur 设计并由您真正实现。回覆。你的解读:

Different verify_attribute/3 handlers hooked on Var, see the same state of Var: All see it "pre_unify".

没错。

verify_attribute/3 must not bind Var, but it may bind other attributed variables.

没错。

These bindings are to be delayed, too, so that the handlers not only see the same state of Var, but of all attributed variables involved.

错了。如果它绑定其他属性变量,整个扩展统一机制将在这些变量上递归调用。

Above list of actions entails "5. Force any delayed bindings of attributed variables."

错了。