@safe D requires which DIP switches?

Elronnd elronnd at elronnd.net
Sat Jan 8 13:33:26 UTC 2022


On Friday, 7 January 2022 at 08:46:27 UTC, bauss wrote:
> It would be a somewhat correct approach, because while in 
> theory you can throw from pure functions, then you violate the 
> purity by observing the thrown exception.
>
> 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.

Exceptions can be modeled as return values. This is a strictly 
local rewrite.  So it is no more a violation of purity than is 
writing to memory pointed to by passed-in pointers (and arguably 
less).


More information about the Digitalmars-d mailing list