Shape-guarded expression isn't
|
|
Bugzilla Link |
346 |
Created on |
Feb 17, 2007 21:14 |
Resolution |
FIXED |
Resolved on |
Feb 19, 2007 17:48 |
Version |
1.00beta |
OS |
Linux |
Architecture |
PC |
Attachments |
lazy-dispatch-error.patch |
Extended Description
I'm not sure if this is a SAC design bug or a SAC documentation bug, but I don't
see an obvious way around this problem. The following code complains about eqIIB
types,yet the offending function is guarded by dim() and shape() comparisons
that should ensure that eqIIB never gets called, except with arguments of
the same rank.
----------------------------cut here-------------------
use StdIO: all;
use Array: all;
inline bool sameIIB(int[*] x, int[*] y)
{ /* Non-scalar match non-scalar */
z = dim(x) == dim(y);
if (z)
z = z & all(shape(x) == shape(y));
if (z)
z = z & with(0*shape(y) <= iv < shape(y))
fold(&, true,
eqIIB(x[iv], y[iv]));
return(z);
}
inline bool eqIIB(int x, int y)
{ return(x == y);
}
int main()
{
x = genarray([2,3,4], 5);
y = genarray([2,5], 6);
print(sameIIB(x,y));
return(0);
}