Another idiom I wish were gone from phobos/druntime

Dragos Carp via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 5 06:09:39 PST 2015


On Thursday, 5 February 2015 at 01:09:15 UTC, Andrei Alexandrescu 
wrote:
> On 2/4/15 4:50 PM, Jonathan Marler wrote:
>> On Thursday, 5 February 2015 at 00:42:01 UTC, Andrei 
>> Alexandrescu wrote:
>>> On 2/4/15 4:40 PM, Jonathan Marler wrote:
>>>> On Thursday, 5 February 2015 at 00:35:50 UTC, bearophile 
>>>> wrote:
>>>>> Contracts can be read by tools, and they are part of the 
>>>>> function
>>>>> signature. Contracts should be encouraged and increased, not
>>>>> discouraged.
>>>>>
>>>>> Bye,
>>>>> bearophile
>>>>
>>>> Not to mention that contracts can be removed by the compiler 
>>>> at compile
>>>> time.
>>>
>>> Same about asserts. -- Andrei
>>
>> Only if the function is inlined.
>
> Non-debug mode removes asserts statically. -- Andrei

This is correct only if non-debug mode means -release flag 
specified.

For example the dub documentation is misleading saying that 
-debug flag enables contracts [1]. The contracts are by default 
enabled, -release disable them.


[1] http://code.dlang.org/package-format#build-options



More information about the Digitalmars-d mailing list