Making preconditions better specified and faster

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 18 13:58:57 PST 2016


On 12/18/2016 04:24 PM, Caspar Kielwein wrote:
> On Sunday, 18 December 2016 at 10:47:42 UTC, Stefan Koch wrote:
>> On Sunday, 18 December 2016 at 09:32:53 UTC, Caspar Kielwein wrote:
>>> On Thursday, 15 December 2016 at 18:48:22 UTC, Andrei Alexandrescu
>>> wrote:
>>>> https://issues.dlang.org/show_bug.cgi?id=16975
>>>
>>> I'd love if preconditions where available at the caller. This would
>>> make it possible to use preconditions for input scrubbing, even in
>>> release builds with disabled asserts.
>>
>> That is exactly what they are not for.
>
> I know that contracts are for specifying guarantees and conditions in
> regards to correctness of a program.

A simple way to look at this is: a program may build and run with all 
contracts disabled. If correct, there should be no change in semantics. 
Is a contract therefore a right place to make sure your files are not 
corrupt etc? -- Andrei



More information about the Digitalmars-d mailing list