Dicebot on leaving D: It is anarchy driven development in all its glory.

Nicholas Wilson iamthewilsonator at hotmail.com
Fri Aug 31 00:49:59 UTC 2018


On Thursday, 30 August 2018 at 23:03:57 UTC, Walter Bright wrote:
> On 8/25/2018 4:49 PM, Nicholas Wilson wrote:
>> Run semantic3 on the constructor independent of the 
>> requirement to destruct already constructed objects. If the 
>> constructors is nothrow then there is no need to have the 
>> destructors run or the eh code at all, because no Exceptions 
>> can be thrown (an Error may be thrown but that will kill the 
>> program). This is how I intend to fix it after I refactor 
>> semantic3.
>
> A function can be made nothrow by:
>
>     try {
>        ....
>     } catch (Exception e) {
>        ... handle it locally ...
>     }

Then I should have said: no exceptions can propagate, which is 
the real problem.

> Also, your proposal is ignoring the destructors, which is 
> literally what the compiler does now.

It was implicit in that the throwing case would call the 
destructors in the event of an exception (otherwise the bug ain't 
fixed). This formulation is to reduce the amount of breakage, 
which was the problem last time.

Yes this will break (as in code breakage) @safe ctors calling 
@system dtors but, such is life. The ctor probably shouldn't be 
throwing in the first place. I'll probably add -vthrowingctor and 
-vthrowingdtor as well since this will be a perf hit in the case 
of a throwing ctor.

Sorry for any confusion.


More information about the Digitalmars-d mailing list