SICStus Prolog offers an abstract datatype ("mutable term") for efficient backtrackable destructive assignment.
The user's manual subsection on mutable terms states:
Please note: the effect of unifying two mutables is undefined.
Let's say another Prolog system wants to implement mutable terms.
Unlike SICStus Prolog that other system wants to define the above effect using the catch
/ throw
error mechanism.
What could be suitable error terms? According to ISO/IEC 13211-1:1995:
7.12.2 Error classification [...]
e) There shall be a Permission Error when it is not permitted to perform a specific operation. It has the form
permission_error(Operation, PermissionType, Culprit)
where
Operation
∈ {access
,create
,input
,modify
,open
,output
,reposition
}and
PermissionType
∈ {binary_stream
,flag
,operator
,past_end_of_stream
,private_procedure
,static_procedure
,source_sink
,stream
,text_stream
}and
Culprit
is the argument or one of its components which caused the error.[...]
j) There may be a System Error at any stage of execution. The conditions in which there shall be a system error, and the action taken by the processor after a system error are implementation dependent. It has the form
system_error
.
So system_error
might be an option, but I think that a permission_error
would be better.
How about permission_error(modify,mutable_term,(=)/2)
?