扩展统一,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:
- For each relevant module
M
, M:verify_attributes/3
is called, collecting a list of returned Goals
.
- The variable binding is redone.
- Any
Goals
are called.
- Any goals blocked on the variable, that has now become unblocked, are called.
到目前为止,我对上面的内容有以下解释:
不同的verify_attribute/3
handlers hooked on Var
,看到Var
的相同状态:全部看到它“pre_unify”。
verify_attribute/3
不能绑定Var
,但可以绑定其他属性变量。
这些 绑定也将被延迟,以便处理程序不仅看到 Var
的相同状态,而且看到 所有个涉及的属性变量。
以上操作列表包含“5. 强制属性变量的任何延迟绑定。”
我的方向是否正确——这个“完成,然后撤消,然后重做”是什么意思?
请帮忙!
该机制最初由 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."
错了。
我想了解 SICStus 风格的可扩展统一。
User's Manual on library(atts)
指出:
Module:verify_attributes(-Var, +Value, -Goals)
hook...
verify_attributes/3
may invoke arbitrary Prolog goals, butVar
should not be bound by it. BindingVar
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:
- For each relevant module
M
,M:verify_attributes/3
is called, collecting a list of returnedGoals
.- The variable binding is redone.
- Any
Goals
are called.- Any goals blocked on the variable, that has now become unblocked, are called.
到目前为止,我对上面的内容有以下解释:
不同的
verify_attribute/3
handlers hooked onVar
,看到Var
的相同状态:全部看到它“pre_unify”。verify_attribute/3
不能绑定Var
,但可以绑定其他属性变量。这些 绑定也将被延迟,以便处理程序不仅看到
Var
的相同状态,而且看到 所有个涉及的属性变量。以上操作列表包含“5. 强制属性变量的任何延迟绑定。”
我的方向是否正确——这个“完成,然后撤消,然后重做”是什么意思? 请帮忙!
该机制最初由 Christian Holzbaur 设计并由您真正实现。回覆。你的解读:
Different
verify_attribute/3
handlers hooked onVar
, see the same state of Var: All see it "pre_unify".
没错。
verify_attribute/3
must not bindVar
, 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."
错了。