Leonhard Moehring on Mon, 08 Nov 1999 11:22:11 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: if-bug

Michael Somos wrote:
>> ? if([1]==1,)
>>   ***   forbidden addition t_INT + t_VEC.
>> Seems like a bug to me.
>Actually, no. It is a feature. You can multiply or divide a vector
>by a scalar, but not add or subtract. In this case, comparison is
>in the same class as addition, hence is not allowed. Thus we get :

hmm.. are you really sure it is a useful feature? After all, if i want
to check identity of two GENs, first of all i need to check if one of
them is a vector, and the other is a scalar, just in order not to crash
my program? after all, many other tests, like "a"==1 work fine. I haven't
checked if any other types fail this test, since i'm only interested
in scalars or vectors. Of course short-circuit logic allows to have one
if statement with && to do the job but i don't really see an advantage
in it. [1]==1 should just yield 0 imho.

On the other hand, if you feel it is useful, don't you think that the 
error message is misleading? You know that "in this case, comparison is
in the same class as addition", but if someone is looking for bugs in a 
long program someone just might not think of it :)

Thanks, Leonhard