For compilation errors, one can argue that what I need to do to go to the line in my editor is just typing /MyCoolAndLongProcedure<CR>2798j instead of 6294gg, but definitely 6294gg is easier to type and the former may not be easy for some editors. (OK, one could argue that we should ignore people who use minor editors that are not (neo)vim or stedi.) In principle such line information can be stored when #procedure is processed.
For runtime errors, the compiler buffer may store the line information such that they can be mapped from the program counter. But it would be not trivial to print error messages with the line information in core functions in deep (e.g., in reken.c) that currently just calls Terminate(-1) when an error occurs.
In modern programming languages, it can be easily solved by separating the code printing error messages from the point where an error occurs by just raising an exception, like
void Generator_or_Normalize(int program_counter) {
try {
...
} catch(const std::exception &e) {
MesPrint(<use the program_counter and e->what()>)
}
}
void Function_in_Deep(WORD *term) {
...
if ([[unlikely]] has_error()) {
throw some_error("an error occurred because blah blah blah...")
}
...
}
It would be nice if we could know the filename and line number when a compile/runtime error occurred. Currently what we can get is something like
or
For compilation errors, one can argue that what I need to do to go to the line in my editor is just typing
/MyCoolAndLongProcedure<CR>2798j
instead of6294gg
, but definitely6294gg
is easier to type and the former may not be easy for some editors. (OK, one could argue that we should ignore people who use minor editors that are not (neo)vim or stedi.) In principle such line information can be stored when#procedure
is processed.For runtime errors, the compiler buffer may store the line information such that they can be mapped from the program counter. But it would be not trivial to print error messages with the line information in core functions in deep (e.g., in
reken.c
) that currently just callsTerminate(-1)
when an error occurs.In modern programming languages, it can be easily solved by separating the code printing error messages from the point where an error occurs by just raising an exception, like
but not so trivial in C.