Type-incompatible comparisons accepted

This forum is to report technical problems with Rel.
Post Reply
HughDarwen
Posts:121
Joined:Sat May 24, 2008 4:49 pm
Type-incompatible comparisons accepted

Post by HughDarwen » Sun Jun 22, 2014 4:05 pm

Comparisons of tuple expressions of different types and comparisons of expressions of different user-defined scalar types are sometimes accepted instead of giving type errors, as the script below shows. I also tried the comparison t4(10, 20) < t6(10, 'abc') and that caused Rel to crash.


tuple{x 1} = tuple{y 2, x 1}
true

tuple{x 1} = tuple{y 1, x 2}
false

tuple{x 1} < tuple{y 1, x 2}

ERROR: Ordinal comparison operators not supported by TUPLE.
Line 1, column 27 near '2'



type t1 possrep{x int};
type t2 possrep{x int};
type t3 possrep{y int};


Ok.
t1(10) = t2(10)
true

t1(10) = t2(20)
false

t1(10) = t3(10)
true

t1(10) = t3(20)
false

t1(10) < t3(20)
true

t1(10) < t3(10)
false

type t4 possrep{x int, y int};
type t5 possrep{x int, z int};
type t6 possrep{y int, z char};


Ok.

t4(10, 20) = t5(10, 20)
true

t4(10, 20) < t5(10, 20)
false

t4(10, 20) < t5(10, 30)
true

Hugh Darwen

Dave
Site Admin
Posts:368
Joined:Sun Nov 27, 2005 7:19 pm

Re: Type-incompatible comparisons accepted

Post by Dave » Mon Jun 23, 2014 1:53 pm

Thanks for noting these - I've added them to my to-do list.

Post Reply