On 08/06/14 22:57, via Digitalmars-d wrote:
> On Wednesday, 6 August 2014 at 17:36:00 UTC, Artur Skawina wrote:
>>    if (0)
>>       assume(0);
>>
>> Yes, `assume` could be defined in a way that would make this
>> always a compile error. But then `assume(0)` would be useless.
> 
> I don't think so. It makes a lot of sense to halt compilation if you from 
> templates or other constructs emit assume(true==false) or assert(true==false) 
> or any other verification-annotation that contradicts predefined language 
> axioms in a way that the compiler can detect at compile time. Otherwise you 
> risk having "unreachable" unintended in generic code.

D already has `static assert`, which can be used for compile-time
checks. Eliminating unreachable paths based on the extra information
from (a combination of) `assume` statements is desirable, and exactly
what this thread is about.

I get what you're saying, but it's not really relevant in the context
of `D`; such fundamental changes are not exactly likely to happen soon...
OTOH the extremely dangerous assert->assume redefinition seems to be
seriously considered, despite the grave consequences...

artur

Reply via email to