From: Bob Alexander Date: 2002-03-22T03:31:41+09:00 Subject: Re: Thought on "abort with message" RCR > Bob Alexander wrote: > > The RCR: http://www.rubygarden.org/article.php?sid=193. > > It's implemented in 1.7. Wonderful! > > It seems that the proper implementation would be that an > > optional message argument for abort should NOT be printed by > > the abort method. Rather, it should be the "message" of the > > SystemExit exception that abort raises. The default handler > > for SystemExit should be modified to print the exception's > > message (if any) to $stderr before exiting. > > Normal "exit" also raises SystemExit with message "exit", what > should be done? I haven't used the 1.7 implementation -- my comments are based on 1.6.7. I'm happy to see the changes in 1.7! Not having seen the details, let me just say how I hope it is implemented: - "abort" with no message leaves SystemExit#message empty. - "exit" leaves SystemExit#message empty. - The default top level handler for SystemExit prints the message to $stderr unless it is empty, then exits as it already does. (The abort method itself does not print anything, allowing programs to catch the exception and do something else.) - the RCR timidly suggests that it would be nice to have an optional message parameter (2nd parameter) for "exit", too. It seems that this would be useful and compatible with existing code. > p $!.status # => 0 Great. On my 1.6.7, it of course produces "undefined method `status' for #". Bob