-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dif/2 continues to exist even with non-unifiable terms #135
Comments
Same is true for more complex cases:
Why does the goal show as |
I did have a |
Maybe we should ask @triska for a specific example of unintended effects. For one, taking the success of |
I can think of one example: unifying variables with frozen attributes. That could result in an irreversible side effect, ie. printing text to the screen. |
If you want side-effects you should be aware that you are in a language that has different principles. That is, there are certainly certain forms of side-effect that can be made to fit into the language, but keep in mind that |
In any case, I suggest that you use the success of |
@UWN: What answer do you expect from: ?- freeze(X, writeln(a)), dif(X, a). Personally, I would like for example: freeze(X, writeln(a)), dif(X, a). But it seems you are OK with: ?- freeze(X, writeln(a)), dif(X, a). a freeze(X, writeln(a)), dif(X, a). If that's OK, then yes, please do use Personally, I would prefer a predicate that also lets us obtain the m.g.u. of two terms, if any, since that is what is actually needed to implement |
|
OK, what about: ?- dif(X, a), dif(X, b). and |
I fail to see the recursion here. Whenever one of the constraints checks for consistency, it must not be present as a constraint indeed. |
OK. Personally, I recommend to avoid triggering constraints within constraint propagation in such an uncontrolled way, but it may be worth trying it out. |
For long there has been this taboo to do things with cuts and constraints at the same time. |
The issue is for implementors of constraint solvers to consider all situations that may arise when a unification or constraint is posted. Calling But this is exactly what for example Binding Var will result in undefined behavior. |
What happens with frozen goals that are executed? The very same should happen for |
In fact SICStus has |
What would make this approach so attractive is that it does not require any explicit term traversal. |
The fundamental difference between |
Yet, the very same can also be said about CLP(ℤ) constraints like In my personal view, triggering execution of constraints within a propagator in such a way is not to be taken lightly and may lead to unintended consequences, though as I said, it may be worth trying. |
Posting Further: As far as I understand, this The current approaches are mainly targeted towards CLPQ. Note that simple minded implementations of clpfd were happy enough using freeze/2 and frozen/2 alone (think of Fages). |
Nevertheless, the current baroque
All their complex paths did not help them to resolve that (and I admit it is probably not worth doing that). And then:
ad nauseam. |
I have not even started work on |
Here is an implementation sketch of
So it boils down to this And, btw, are there any syntactic problems? See the open issues. It's that rather non-ISO stuff is in the kernel. Like |
This addresses one part of mthom#135.
I have filed #682 to try this. |
In this case there is no reason to create anything at all, since the terms are already non-unifiable (that is
a \= s(X)
)The text was updated successfully, but these errors were encountered: