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

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
From:
David Golden
Date:
July 25, 2013 13:35
Subject:
Re: Try/Catch Exception Objects: Possible?
Message ID:
CAOeq1c-omF31=MW5dSrNXYoX-sOMehm+8iACxMFkwzqtYQ_OmA@mail.gmail.com
On Thu, Jul 25, 2013 at 6:42 AM, David E. Wheeler <david@kineticode.com> wrote:
>> On Tue, Jul 23, 2013 at 3:56 PM, David E. Wheeler <david@kineticode.com> wrote:
>>> The catch block should not do conditional execution. One should use a switch statement or whatever inside the catch block.
>>
>> Why not? Please make a real case for that opinion.
>
> The case is just that we should try to focus on fundamentals, first. This sort of thing can be added once the fundamentals work.

That's different than what you said.  "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.

>> 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.

David


-- 
David Golden <xdg@xdg.me>
Take back your inbox! → http://www.bunchmail.com/
Twitter/IRC: @xdg

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About