Discussions related to Visual Prolog
Martin Meyer
VIP Member
Posts: 354 Joined: 14 Nov 2002 0:01
Post
by Martin Meyer » 30 Jul 2014 21:44
Hi Thomas,
in new VIP 7.5 the clause
throws
error c609 : Variable 'X' is not completely bound . Is it a bug or has Must Unify been changed for a reason?
Regards,
Martin
Vitaly Markov
Active Member
Posts: 40 Joined: 30 Nov 2003 0:01
Post
by Vitaly Markov » 31 Jul 2014 7:32
Code: Select all
run( ) :-
X = read( ) ,
X == 1 ,
write( "Ok" ) .
If you input 1 then "Ok". Else exception.
Thomas Linder Puls
VIP Member
Posts: 1469 Joined: 28 Feb 2000 0:01
Post
by Thomas Linder Puls » 31 Jul 2014 10:40
Yes, must unify has been changed.
Your example clause should use a regular "=", using "==" is misleading because it indicates (to other programmers) that a "cannot unify" exception could potentially be raised, which it can't.
"=" and "==" have same semantics for terms that will always unify, but it was never the intention to let "==" play the role of "=" in such cases.
Regards Thomas Linder Puls
PDC
Martin Meyer
VIP Member
Posts: 354 Joined: 14 Nov 2002 0:01
Post
by Martin Meyer » 31 Jul 2014 14:40
Thanks Thomas! I see.
Btw. the change of Must Unify does not cover flows like for example (tuple(o, o), tuple(i, i)). The clause
Code: Select all
run( ) :-
tuple( X , Y ) == tuple( 1 , 2 ) .
is still compiling. I suppose, you liked to exclude such usages too.
Regards,
Martin
Thomas Linder Puls
VIP Member
Posts: 1469 Joined: 28 Feb 2000 0:01
Post
by Thomas Linder Puls » 1 Aug 2014 8:11
In principle, but I am not sure it is worth the effort.
Regards Thomas Linder Puls
PDC