From octave-maintainers-request at bevo dot che dot wisc dot edu Mon Jan 13 10:37:48 2003 Subject: Re: variable(s) for signal numbers? From: Andy Adler To: "John W. Eaton" cc: octave-maintainers mailing list Date: Mon, 13 Jan 2003 11:37:20 -0500 (EST) On Fri, 10 Jan 2003, John W. Eaton wrote: > On 10-Jan-2003, Andy Adler wrote: > | Additionally, you then would have the semantics to > | pull some 'perl'ish tricks and define virtual signals. > | > | I'm refering to $SIG{__WARN__} and $SIG{__DIE__}, > | which refer to code doing the corresponding things. > > I'm not sure how this would work. > > I am also interested in being able to set up handlers for signals > inside Octave code, so you could have your own handlers. But this > will require a bit more work, I think. Yes, this would clearly require more work. I was mentioning the the syntax could be extended in this way. Now that I look at it, Much of the general consensus within the Perl community seems to be "$SIG{__DIE__} considered harmful". People are encouraged to use Perl exception handling instead. Perl uses die both to end script execution (as in error), or like "throw" for exceptions. I just checked Matlab's version of try/catch, and it is very similar to Perl, in that error is used to throw an (untyped) exception, which is then caught with "catch". FWIW, I'm not a big fan of this kind of semantic overloading (of "die" or "error"). I'll now retract my suggestion, as I no longer think its a particularly good idea. Andy