Question: why ArrayTools:-AllNonZero do not seem to check the type of its arguments?

I was saying to myself today, that one nice thing in Maple, is that it has good type system so one can check type of arguments aginst wrong types being used in the call.

So I was surprised when I called ArrayTools:-AllNonZero  using list as argument, where this function is supposed to accept only Matrix,Vector or Array. And it worked.  But it gave wrong answer at the same time.

Am I doing something wrong here? Should not have this call failed to go through?

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):

A:=[0,0,0];
ArrayTools:-AllNonZero(A)

Maple replied 

                       true

But 

A:=Array([0,0,0]);
ArrayTools:-AllNonZero(A)

Now Maple gives the expected result  false

The question is why Maple did not detect the wrong type? Should it have detected wrong type?

And why it even gave wrong answer (but this is not as important, since the call should not be allowed in first place).

btw, this applied to all the other API's listed

 

 

Please Wait...