status of D optimizers benefiting from contracts ?

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 10 03:31:20 PST 2014


On Sunday, 9 November 2014 at 22:41:29 UTC, H. S. Teoh via 
Digitalmars-d-learn wrote:
> On Sun, Nov 09, 2014 at 09:57:21PM +0000, eles via 
> Digitalmars-d-learn wrote:
>> On Sunday, 9 November 2014 at 16:31:46 UTC, bearophile wrote:
>> >H. S. Teoh:
>> >
>> >>It's only a bad idea because people abuse assert() where 
>> >>it's not
>> >>appropriate.
>> >
>> >It's a bad idea because Walter seems unable to understand the
>> >difference between verifying and proving.
>> 
>> I fail to see the difference between assert() and a 
>> hypothetical
>> assume().
>
> The original meaning of assert() is what assume() means 
> nowadays,
> whereas nowadays what people think of as assert() is actually 
> what
> enforce() does in Phobos.

No, enforce() is obviously intended for verifying user input, not 
for checking program logic, that's why it throws an Exception, 
not an Error. The documentation even says so explicitly:

http://dlang.org/phobos/std_exception.html#.enforce


More information about the Digitalmars-d-learn mailing list