Re: Catching exceptions with the // operator

2008-08-08 Thread Yaakov Belch
Thank you very much! my $bill = try ack() orelse try thpp() orelse do ppt(); This certainly does what I asked for, and it's short enough (even if we need to add a few brackets). Yes, the basic problem with the proposal is that it catches all exceptions willy nilly and

Re: Catching exceptions with the // operator

2008-08-08 Thread TSa
HaloO, Yaakov Belch wrote: I believe that ---from a usability point of view--- it's very important to: * classify exceptions by severity or other characteristics, * provide named adverbs/pragmas to modify default CATCH handlers, * make them configurable by outer scopes. [..] The programmer

Re: Catching exceptions with the // operator

2008-08-06 Thread jerry gay
On Wed, Aug 6, 2008 at 8:58 AM, Yaakov Belch [EMAIL PROTECTED] wrote: In a little language that I wrote some time ago, I found it very useful to let the // operator catch exceptions: f(x) // g(y) does: * If f(x) returns a defined value, use this value. * If f(x) returns an undefined value,

Re: Catching exceptions with the // operator

2008-08-06 Thread Paul Seamons
in my mind, this strays too far from the meaning of C// and adds ambiguity that makes the operator unusable. perhaps there's room for an operator that gives some sugar for my $bill = try { ack() CATCH { thpp() } }; but to me that code is concise enough that it doesn't warrant syntactic

Re: Catching exceptions with the // operator

2008-08-06 Thread John M. Dlugosz
Yaakov Belch perl6-at-yaakovnet.net |Perl 6| wrote: Let me explain why this is useful and why I think this is the right thing: First of all, it provides a very light-weight exception handling using well-known ideoms like: $file_content=read_file($filename) // $default_value;