Can you help me to solve the following error:-
Conflicting support instances 'expression{@Type}{::user_defined}' and 'expression{@Type}{::range}'
It arises from compiling the code below comprising of parameterized interfaces. I intended to use the parameterized interfaces to allow the compiler to report such errors as mixing of data types. For instance, in
X:add(Y) = Z,
The compiler would report an error if X, Y and Z are not expressions of the same type, thus preventing me from mixing ranges with scalar. However, ranges and scalars all belong to a category of expressions referred to as user defined expressions. It is this fact that I am trying to implement in the following code.
Code: Select all
interface expression{@Type}
properties
type:@Type.
predicates
add:(expression{@Type})->expression{@Type}.
end interface
interface user_defined supports expression{user_defined}
end interface
interface range supports user_defined, expression{range}
end interface
interface scalar supports user_defined, expression{scalar}
end interface
implement main
open core
clauses
run() :-
succeed.
end implement main
goal
console::runUtf8(main::run).