Error messages and line numbers display



Stefano Ferri wrote:
>> Do you have a small example of the problem?
>>     
>
> Yes, of course. In your example you get the error, together with the line 
> number. You have defined the function foo, loaded test.mac and executed bar(). 
> In this way, line numer is displayed.
> But try to create a file with this simple command and load it:
>
> if matrix_size(a)=1 then print("hello");
>
> load("test.mac") gives the anonymous
>
> The first argument of the function matrix_size must be a matrix
>  -- an error.  To debug this try debugmode(true);
>
> I have a .mac file (it's more than 1000 lines) with a lot of matrix_size 
> checks, so I would appreciate if Maxima displayed line numbers. Anyway, as you
1000 lines without any functions?  Sounds like some refactoring is in
order. :-)

>  
> said, debugmode could help me, but I don't see why I have to use a debugger if 
> Maxima could tell me where is the error. I think such a feature could be 
> really useful, especially to beginners, but convenient also for experienced 
> users. I have been programming in Matlab for years, but I used the debugger 
> only when necessary, not for these little problems.
>   
But you are right, and I agree with you.  When reading from files, I'm
pretty sure maxima knows the line number.  We just have to figure out
how to extract that information out.
>
> Here's some other anonymous errors, in example:
>
> stdin:23262:Incorrect syntax: FOR is not an infix operator
> mit(K2,bk,inf)\n\tfor
>   
I think "stdin:23262" is an hint that the error occurred on character
23262.  Not quite as nice as a line number, but it can help you find the
offending code.

Ray