On Wed, Sep 19, 2012 at 10:24 PM, John W. Eaton
<address@hidden> wrote:
BTW, getting location info for warnings is already implemented. You
just need to do
warning on backtrace
Maybe we should make this the default? I don't know. It could result
in lots of info being dumped to the terminal. The backtrace option
needs to be documented. Anyone?
That's great! I didn't know that existed. I would not make this default, the verbosity isn't worth it. Two suggestions come to mind:
1)
A slightly different approach would be to change the available warning states from {"on", "off", "error"} to perhaps {"on", "off", "verbose", "error"}. So, for example
warning on Octave:broadcast
would behave as it currently does and to get backtraces you could
warning verbose Octave:broadcast
2)
Another option is to always emit a brief breadcrumb (not the full backtrace) for every warning. Something short and terse like a " (function:line)" suffix so that
warning: operator +: automatic broadcasting operation applied
becomes
warning: operator +: automatic broadcasting operation applied (myfunc:32)
My instinct is that this brief hint would be "good enough" in most cases to find the offending code.
--judd