[Scilab-users] imprecise error messages

classic Classic list List threaded Threaded
4 messages Options
fmiyara fmiyara
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] imprecise error messages


Dear All,

I'm trying to use the error messages available at https://help.scilab.org/docs/6.0.2/en_US/error_table.html

However, I cannot find one that describes precisely what is wrong.

My argument is any scalar, vector, matrix or N-D array of real or complex numbers.

If I use

   "%s: Argument #%d: Decimal or complex number expected.\n"

it may convey the idea that only scalars are admissible. I think the word "number" jeopardizes the message. It would be better if the word "type" were clearly mentioned, for instance "Wrong input type: %d expected.\n"

If I use

   "%s: Argument #%d: Hypermatrix expected.\n"

it may be interpreted as if, for instance, a polynomial hypermatrix would be acceptable.

Testing abs() on a string yields

   --> abs("hello")
   in builtin                abs

   Function not defined for given argument type(s),
     check arguments or define function %c_abs for overloading.

This gives a hint where is the problem, but does not indicate what type is expected, which would be more useful.

Regards,

Federico Miyara

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: imprecise error messages

Le 06/02/2020 à 22:55, Federico Miyara a écrit :

Dear All,

I'm trying to use the error messages available at https://help.scilab.org/docs/6.0.2/en_US/error_table.html

However, I cannot find one that describes precisely what is wrong.

My argument is any scalar, vector, matrix or N-D array of real or complex numbers.

If I use

   "%s: Argument #%d: Decimal or complex number expected.\n"

it may convey the idea that only scalars are admissible. I think the word "number" jeopardizes the message. It would be better if the word "type" were clearly mentioned, for instance "Wrong input type: %d expected.\n"


Yes, but to me, "input" is useless, since only input types are testable. In addition, the argument's number must appear. So yes, something like

"%s: Argument #%d: Decimal or complex type expected.\n"

would be better. A still more open message is possible and already listed:

"%s: Argument #%d: %s expected.\n"


If I use

   "%s: Argument #%d: Hypermatrix expected.\n"

it may be interpreted as if, for instance, a polynomial hypermatrix would be acceptable.

Yes, or of any other type, since this message only informs about the size / format, not about the data type. It is is in the same messages section "Checking container's dimension and sizes" than other messages about the shape / array size.



Testing abs() on a string yields

   --> abs("hello")
   in builtin                abs

   Function not defined for given argument type(s),
     check arguments or define function %c_abs for overloading.

This gives a hint where is the problem, but does not indicate what type is expected, which would be more useful.


But impossible. An error message is not aimed to replace the help page. There may be many possibilities.
If in the function that you write you want to display the documented list of available syntaxes for this function, just before the proper error message, then disp_usage() is made for you, available in the uman package: https://atoms.scilab.org/toolboxes/uman 
atomsInstall uman

Samuel



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: imprecise error messages

Le 06/02/2020 à 23:17, Samuel Gougeon a écrit :
Le 06/02/2020 à 22:55, Federico Miyara a écrit :

Dear All,

I'm trying to use the error messages available at https://help.scilab.org/docs/6.0.2/en_US/error_table.html

However, I cannot find one that describes precisely what is wrong.

My argument is any scalar, vector, matrix or N-D array of real or complex numbers.

If I use

   "%s: Argument #%d: Decimal or complex number expected.\n"

it may convey the idea that only scalars are admissible. I think the word "number" jeopardizes the message. It would be better if the word "type" were clearly mentioned, for instance "Wrong input type: %d expected.\n"


Yes, but to me, "input" is useless, since only input types are testable. In addition, the argument's number must appear. So yes, something like

"%s: Argument #%d: Decimal or complex type expected.\n"

would be better.

Just a little issue, that is not disturbing for me: "decimal" and "complex" are not proper Scilab types.
From there, we certainly won't go on discussing about "constant", "double" and "number",
as we recently did here.
But the term "number" has been proposed for this reason.
So, may be it is not so bad.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: imprecise error messages

Le 07/02/2020 à 02:28, Samuel Gougeon a écrit :
Le 06/02/2020 à 23:17, Samuel Gougeon a écrit :
Le 06/02/2020 à 22:55, Federico Miyara a écrit :

Dear All,

I'm trying to use the error messages available at https://help.scilab.org/docs/6.0.2/en_US/error_table.html

However, I cannot find one that describes precisely what is wrong.

My argument is any scalar, vector, matrix or N-D array of real or complex numbers.

If I use

   "%s: Argument #%d: Decimal or complex number expected.\n"

it may convey the idea that only scalars are admissible. I think the word "number" jeopardizes the message. It would be better if the word "type" were clearly mentioned, for instance "Wrong input type: %d expected.\n"


Yes, but to me, "input" is useless, since only input types are testable. In addition, the argument's number must appear. So yes, something like

"%s: Argument #%d: Decimal or complex type expected.\n"

would be better.

Just a little issue, that is not disturbing for me: "decimal" and "complex" are not proper Scilab types.
From there, we certainly won't go on discussing about "constant", "double" and "number",
as we recently did here.
But the term "number" has been proposed for this reason.
So, may be it is not so bad.


In addition, "Real or complex type expected.\n" could be ambiguous.
Indeed, it may as well qualify polynomials, or rationals.
So, all in all, as you see, it's not so easy to find good unambiguous and not too technical terms.

We know that the longer and more technically worded error messages are, the less read they are.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users