scope() statements and return
monarch_dodra via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 6 09:55:38 PDT 2014
On Monday, 6 October 2014 at 14:54:21 UTC, Andrei Alexandrescu
wrote:
> On 10/6/14, 7:24 AM, monarch_dodra wrote:
>>
>> If your "catch" throws an exception, then the new exception
>> simply
>> "squashes" replaces the old one:
>>
>> //----
>> catch (Exception e)
>> {
>> thisMightThrow(); //Lose "e" here
>> throw e;
>> }
>> //----
>
> That's code under library/user control, I'm talking about the
> responsibility of the language. -- Andrei
Right. but if correct usage is so cumbersome no one does it
right, then it is 's/the responsibility/a flaw/' of the language.
Are we advocating then that code under user control should
systematically look like this?
catch (Exception e)
{
try
{
thisMightThrow(); //Lose "e" here
}
catch(Exception ee)
{
findLast(e).next = ee; //because e.next might
}
throw e;
}
Honestly, a good middle ground is to ditch chaining, but allow
multiple exceptions thrown at once. Subsequent Exceptions/Errors
will just be lost (sorry), with the exception that an Error will
override an Exception.
For the sake of argument, do you have any examples where a
program has used chaining?
More information about the Digitalmars-d
mailing list