What should happen when the assert message expression throws?

Timon Gehr timon.gehr at gmx.ch
Thu Dec 8 15:03:35 UTC 2022


On 11/26/22 13:32, Ali Çehreli wrote:
> - If configFile was a string input by the user, then the following is 
> appropriate:
> 
>    enforce(exists(configFile), /* ... */)
> 
> - If configFile was a string representing a file e.g. that has just been 
> generated by the same program, then the following is appropriate:
> 
>    assert(exists(configFile), /* ... */)
> 
> Only the programmer knows.

I don't think it is appropriate to assert that the filesystem is not 
being changed concurrently by some other process unless the OS provides 
explicit functionality to enforce it.


More information about the Digitalmars-d mailing list