'catch' statement modifier

2003-11-23 Thread Luke Palmer
I was reading over some code that used the MIDI module, and saw the C method. I began wondering, how does one report the error if he feels like it, but let the module report the error if not, in a concise way. What about something along the lines of a C statement modifier, like: $opus.write_

Re: 'catch' statement modifier

2003-11-23 Thread Tony Olekshy
Luke ~ These matters are covered at some length in RFC 88 and Apocalypse 4. http://www.avrasoft.com/perl6/rfc88.htm http://www.perl.com/pub/a/2002/01/15/apo4.html Yours, &c, Tony Olekshy Luke Palmer wrote, at 2003-11-23 11:55: > > I was reading over some code that used the MIDI module

Re: 'catch' statement modifier

2003-11-23 Thread Damian Conway
I was reading over some code that used the MIDI module, and saw the C method. I began wondering, how does one report the error if he feels like it, but let the module report the error if not, in a concise way. What about something along the lines of a C statement modifier, like: $opus.write_to

RE: 'catch' statement modifier

2003-11-23 Thread Austin Hastings
> -Original Message- > From: Damian Conway [mailto:[EMAIL PROTECTED] > > Remember that a C without a C catches all exceptions > and returns > C (the same as a Perl 5 C block does). > > So you just want: > > try { $opus.write_to_file($file) } > err die "Couldn't writ

Re: 'catch' statement modifier

2003-11-23 Thread Damian Conway
Austin Hastings wrote: try { $opus.write_to_file($file) } err die "Couldn't write to $file: $!\n"; Is that C or C ? It's C, which is low precedence C. And if so, what's C and where can I find more on it? http://dev.perl.org/perl6/exegesis/E04.html#Read_or_Die Damian

Re: 'catch' statement modifier

2003-11-23 Thread Damian Conway
Hmm. I think I may have missed Luke's point. Which was (presumably): what if C<$opus.write_to_file($file);> validly returns C? In which case I think we just fall back to: try{$opus.write_to_file($file); CATCH {die "Couldn't write to $file: $!"}} which is, after all, only 5 characters long

Re: 'catch' statement modifier

2003-11-23 Thread Jonathan Scott Duff
On Sun, Nov 23, 2003 at 03:53:00PM -0500, Austin Hastings wrote: > > -Original Message- > > From: Damian Conway [mailto:[EMAIL PROTECTED] > > > > Remember that a C without a C catches all exceptions > > and returns > > C (the same as a Perl 5 C block does). > > > > So you just want: > >