Concept proposal: Safely catching error

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 5 03:59:28 PDT 2017


On Monday, 5 June 2017 at 09:50:15 UTC, Olivier FAURE wrote:
> My proposal for solving these problems would be to explicitly 
> allow to catch Errors in @safe code IF the try block from which 
> the Error is caught is perfectly pure.
>
> This would allow to design applications that can fail 
> gracefully when dealing with multiple independent clients or 
> tasks, even when one of the tasks has to thrown away because of 
> a programmer error.
>
> What do you think? Does the idea have merit? Should I make it 
> into a DIP?

Pragmatic question: How much work do you think this will require?
Because writing a generic wrapper that you can customize the 
fault behaviour for using DbI requires very little[1].

[1] 
https://github.com/Calrama/libds/blob/fbceda333dbf76697050faeb6e25dbfcc9e3fbc0/src/ds/linear/array/dynamic.d


More information about the Digitalmars-d mailing list