Stefano Ferri wrote:
>> It might be helpful to do as suggested and try debugmode(true). When the
>> error is reached, you should be able to get a backtrace and the
>> backtrace will show the line number.
>>
>> Ray
>>
>
> Yes, of course, but I think it would be nice if such a feature was added,
> errors would be clearer. Maxima could easily and automatically find where the
> error is located, and show the line. I think users programming in maxima's
> language and writing .mac files would appreciate that. In particular, why
> should one debug the code when the solution could be so simple? A large part
> of scientific scripting-oriented programs show errors with such details.
>
Do you have a small example of the problem?
Here is what I get. I created a test.mac file with the following contents:
foo(a):=matrix_size(a);
bar():=
block([],
a:[1,2],
b:[[1,2],[3,4]],
foo(a),
foo(b));
Then, load("test.mac")$ bar()$ gives the following:
(%i2) bar();
The first argument of the function matrix_size must be a matrix
#0: foo(a=[1,2])(linearalgebra.mac line 310)
#1: bar()(test.mac line 6)
-- an error. To debug this try debugmode(true);
Isn't this what you want? The default is to produce a backtrace of 3
frames. That limit should probably be settable by the user.
On the other hand, debugmode(true) is probably not a bad thing to have
enabled, if you're used to dealing with errors like Lisp, where the
debugger is usually enabled by default.
Ray