Martin Baker wrote:
>
> Since compiler error messages have been mentioned I was wondering what
> is your approach to improving error messages?
> I seem to remember Waldek saying that the only way to improve the poor
> error messages is to fix them on a case-by-case basis?
> If so, do you want unhelpful error messages reported here?
>
> For instance messages like this are not very helpful:
>
> >> System error:
> The index 2 is too large.
>
> I have seen this caused when attempting to extend some category or
> domain in an incompatible way.
> For instance, several times I have unintentionally used the name of an
> existing library category when I was intending to create a new name.
> This sort of error is easy to make so helpful error message would
> improve things.
It is not easy to get better error message. More precisely
my approach in such cases is to do:
)set break break
and then trigger problem again and look at the backtrace.
Usually this is more informative than any error message
could get. Drawback is that you need to look at source
code to find out what really happended. In case like
you mention above, the problem is that we get inconsistent
data structures, as parts of code use old definition while
other parts use new one. Easy way to avoid such errors
would be to forbid redefinition of domains and categories.
But that would force _very_ inefficient developement style,
basically requireing to recompile everthing before each test.
Similarely, trying to ensure that various data structures
are consistent requires nontrivial work. ATM the only
implemented way to do full recompilation. In principle
we could do such check much faster, but the effort is
to implement faster version is comparable with rewritnig
the compiler.
Now, when we have inconsitent data structures, there is
almost nothing we can do to get better error messages,
as diagnosing errors depends on information from data
structures. OTOH while I did get sometimes errors due
to inconsitent domains/categories for me they tends to
be rare and easy to fix: basically when I see weird
error it is moment to think if everyting that should
be recompiled in fact is. I do not remember the last
time such error happened to me, but I think it was at
least few month ago. When I see 'The index 2 is too large'
error it usually what it means: out of bound array access
in my code.
> I have reconstructed this type of error in the 3 examples below.
>
> Just to be clear, I know these are errors, its just the unhelpfulness of
> the message that I'm talking about.
>
> Martin
>
> ----------------------------------------------------------------
> Example 1: gives: The index 2 is too large.
> ----------------------------------------------------------------
> )abbrev category ERR1 Error1
> Error1: Category == Integer with
> myFn:(NNI) -> Boolean
> ----------------------------------------------------------------
> Example 2: gives: The value #(<snip>)is not of type LIST.
> ----------------------------------------------------------------
> )abbrev category ERR2 Error2
> Error2: Category == Integer with
> myFn:(Boolean) -> Boolean
> ----------------------------------------------------------------
> Example 3: gives: >> System error: The index 2 is too large.
> ----------------------------------------------------------------
> )abbrev domain ERR3 Error3
> Error3() : Exports == Impl where
> Exports ==> Integer with
> myFn : (Boolean) -> Boolean
> Impl ==> add
> myFn(inp:Boolean)==inp
OK, that is the same plain error (using Integer as a category)
and compiler should catch it.
--
Waldek Hebisch
--
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.