From bug-octave-request at bevo dot che dot wisc dot edu Fri Jan 23 05:54:39 2004 Subject: Re: m-file warning() could be more useful From: Paul Kienzle To: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 23 Jan 2004 06:53:21 -0500 On Jan 22, 2004, at 11:08 PM, John W. Eaton wrote: > On 11-Dec-2003, Paul Kienzle wrote: > > | octave:35> C('c',2) > | warning: in C near line 10, column 1: > | > | >>> warning ("Replacing definition of constant %s", varargin {i}); > | > | > | warning: Replacing definition of constant c > | > | Should be: > | > | octave:35> C('c',2) > | warning: Replacing definition of constant c > | > | E.g., > | > | octave:36> function f, C('c',3); end > | octave:37> f > | warning: in C near line 10, column 1: > | > | >>> warning ("Replacing definition of constant %s", varargin {i}); > | > | > | warning: Replacing definition of constant c > | > | Should be: > | > | octave:37> f > | warning: in f near line 1, column 1: > | >>> C('c',3); > | Replacing definition of constant c > > OK, I agree that printing out the warning twice is not too useful. > The following patch fixes that, but preserves the location > information, which I think is useful -- you might like to know > precisely which warning call was made when there could be several of > the same format in a given .m file or set of .m files. Of course it > would be more useful if we could get more complete traceback > information, but that is not currently easy to get. I would prefer compact warnings (one line, maybe two), which limits the amount of traceback to a single statement. For the vast majority of cases, users want to know which line of their code is generating the warning/error so they can fix it, which is why I suggested the location in the caller should be displayed. As it stands, aren't warnings from built-ins are flagged as coming from the caller, but not warnings from scripts? Paul Kienzle pkienzle at users dot sf dot net ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------