The extent of trust in errors and error handling

Dukc via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 1 13:55:40 PST 2017


On Wednesday, 1 February 2017 at 19:25:07 UTC, Ali Çehreli wrote:
> Aside, and more related to D: I think this whole discussion is 
> related to another issue that has been raised in this forum a 
> number of times: Whose responsibility is it to execute function 
> pre-conditions?

Regarding that, I have trought that wouldn't it be better if it 
was bounds checking instead of debug vs release what determined 
if in contracts are called? If the contract had asserts, they 
would still be compiled out in release mode like all asserts are. 
But if it had enforce():s, their existence would obey the same 
logic as array bounds checks.

This would let users to implement custom bounds checked types. 
Fibers for example could be made @trusted, with no loss in 
performance for @system code in release mode.


More information about the Digitalmars-d mailing list