> 
> On 04/13/2014 03:38 PM, Waldek Hebisch wrote:
> > We could make the generic message a bit
> > nicer someting like:
> > 
> >    Wrong union branch detected: "failed" of type "failed" is
> >    not of type NonNegativeInteger
> > 
> > or maybe
> > 
> >    "failed" of mode Union(NonNegativeInteger, "failed") cannot
> >    be coerced to mode NonNegativeInteger
> 
> Waldek, if generating this last message would be easy, I would rather
> want to have that instead of just "Error detected in library code".
> 
> If I am not completely wrong than such message very often just means
> wrong user input.

The message is 'Error detected within library code'.  I am not
an expert on English but my impression is that 'within' here means
the same as 'while executing'.  So, there are at least two
possibilities:

- there is an error in the library
- library found an error

AFAICS using 'in' as you did would mean the first possibility,
but actually the second is intended.  Namely, normally this message
is issued when library code find some unexpected data.  Core
reason may be due to user error or due to some bug in
library -- at the place where error is detected we can
not decide whom to blame.  So I think that message is
actually carefully chosen to be short and convey intended
meaning.

Concerning change: I would keep the 'Error detected within library
code' part.  I am just thinking about changing what is written
below it.  Currently the code producing this message is rather
simple-minded: it just calls Lisp functions to get some printable
strings.  After little hacking I get:

   >> Error detected within library code:
   "failed" of mode Union(NonNegativeInteger,"failed") cannot be coerced to 
mode NonNegativeInteger

However, this depends on coercion to Output form and prefix2String.
I am not sure how robust they are (it woulb be embarasing to get
error during printing error message).  Also, values may be quite
big so it would be good to truncate output in such case.

> 
> > 'System error:' comes from underlying Lisp and normaly means a bug,
> > either in FriCAS or the code FriCAS user wrote.
> 
> Actually, it would certainly be easy to add something like:
> 
>   "Please report that problem to [email protected]."
> 
> I don't know how much more traffic that would bring, but guiding the
> user to a place where s/he can get help would probably be a good thing.

Well, it is easy.  But there is one important case when the message
is not a bug.  Namely, we get it in case of division by 0.  This is
detected by hardware or lower level Lisp routines and reported via
Lisp error handler.  Trying to check before division would mean
extra code and loss of time.  IMHO ability to generate our
own error message does not justify the cost.  We could try to
check if error is division by zero, but this requires extra
work.  Not much, but more than just adding message in proper
place.


-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to