@safe D requires which DIP switches?

Dennis dkorpel at gmail.com
Fri Jan 7 09:58:40 UTC 2022

On Friday, 7 January 2022 at 08:46:27 UTC, bauss wrote:
> So it doesn't really make much sense to throw in a pure 
> function in itself, as using the exception will be a direct 
> violation of purity.

Printing the stack trace of an Exception can only happen when you 
catch it in an impure function. In that case the side effects 
happen there, that doesn't make the function that threw the 
Exception impure.

Catching the Exception in a `pure` function is not a violation 
either, whatever you do with the Exception object in the catch 
block is the same as what you could do if the Exception was 
returned instead of thrown.

More information about the Digitalmars-d mailing list