develooper Front page | perl.perl5.porters | Postings from July 2013

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
David E. Wheeler
July 25, 2013 16:36
Re: Try/Catch Exception Objects: Possible?
Message ID:
On Jul 25, 2013, at 3:34 PM, David Golden <> wrote:

> That's different than what you said.

Yeah, but you and everyone else should know what I *mean* no matter what I *say*. :-P

>  "the catch block should not do
> conditional execution" versus "the catch block shouldn't do
> conditional execution in the first draft".   For prototyping, fine,
> but I'd be cautious actually adding an experiment for which we might
> change the syntax later.  I wouldn't necessarily want to wind up with
> "catch" and "catchif" just because "catch" was introduced first
> without any conditionality.

Yeah. My thought, however, is just to KISS.

>>> How about using a non-argument lexical like "for" blocks:
>>>  for my $foo ( list() ) { ... }
>> IIRC, Chip apologized for this syntax, because it’s declared outside the block yet lexically defined inside the block. Is it really something we want to spread?
> It works that way for "while" and "if" and "elseif", too, so at this
> point, I think that's a pretty well-understood, commonly-used Perl 5
> way to do things.

It is? This dies with a syntax error:

    if my $f (1) {
        $f = 'foo';
        say $f;

syntax error at try line 7, near "if my "

This works, of course:

    if (my $f = 1) {
        say $f;



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About