From maintainers-request at octave dot org Thu Dec 8 22:39:28 2005 Subject: Re: message ids for warnings and errors From: Paul Kienzle To: "John W. Eaton" Cc: octave maintainers mailing list Date: Thu, 8 Dec 2005 23:38:09 -0500 On Dec 7, 2005, at 8:41 PM, John W. Eaton wrote: > | Similarly, octave-forge has 27 instances, including > | > | warn_divide_by_zero = 0; > | warn_divide_by_zero = wdz; > | > | Maybe warn could have another state 'expected' which > | suppresses the warning in the local scope? > > I think I'd rather avoid the extra complexity. But maybe you see a > simple way to imlement it? The obvious way is to maintain a list of warning names and states for the current function context and run through this list when the function returns. This does mean the majority of functions have to pay for a feature they do not use, so not an ideal solution. A generalization of this is to support an on_return("...") eval-like statement which is called just before the function returns. This is handy for implementing post-condition checks for programming by contract, but not otherwise very useful. An ugly alternative is to hook into the symbol table with a new octave type which is a subclass of the structure type. When a warning state is set, add a field to the __expected_warning__ structure mapping warning name with the old state. At the end of the function, when the current symbol table is deleted and __expected_warning__ is freed, all warning states can be restored. Either way, this seems like a low priority issue. - Paul