为什么在变量未实例化时 =:= 会报错,而 == 不会?

Why does =:= give an error when the variable is not instantiated, but == doesn't?

3 == X.

会导致答案 'no',但是

3 =:= X

会导致错误:

! Instantiation error in argument 2 of (=:=)/2
! goal:  3=:=_409

为什么会这样?当一个是未实例化的变量时,它们的行为不应该相同吗?

=:=/2 评估 表达式并比较结果 - 因此它不能有任何未完全实例化的术语。

换句话说,X =:= Y 类似于 EX is X, EY is Y, EX = EY - 但它也会进行隐式转换,例如1 =:= 1.0 计算结果为真。