Bill Allombert on Tue, 7 Jan 2003 20:40:28 +0100

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

Re: gp: gcd(0) error message unhelpful

On Tue, Jan 07, 2003 at 02:30:03PM -0500, Michael Somos wrote:
> pari-dev,
>     Bill wrote :
> > Giving one argument is valid iff it is a vector.
> Okay, you are right, however, the documentation is silent on
> what happens in the case gcd(1) or gcd(x). Perhaps it should
> just return what it is given as a harmless response. It would
> be consistent with some other functions that way.

I would prefer it to fail with a more explicit error message.
gcd(x) is certainly a typo.

> > Using "associative (gcd,lcm,chinese)" is wrong because we can add new functions
> > at any time, and we will certainly forget to update the list.
> Perhaps I am missing something here. I thought the purpose of
> PARI-GP was to help users of the program to perform computations.
> Having unhelpful error messages is not a desired behavior. The

Exactly. And false or inacurrate error messages are no better.

> word "associative" is distinctly unhelpful without some kind of
> qualifier. You are welcome to come up with something, but for
> now "associative (gcd,lcm,chinese)" is an easy fix. It conveys
> the general idea, and will be unlikely to change in future.

I would like it to change in the future to support more 
associative operations.

Would you prefer
? gcd(0)
  ***   Data must be a vector for an associative operation.

You can probably propose something better, I have no particular
skill for this task.

One side remark: the use of err(typer,) force the format of the error
message. This mildly annoying, because using typer is more
helpful for trap() users than talker, but that reduces the
usefulness of the error message.