optional feature with contract inheritance? (design question)

Lutger lutger.blijdestijn at gmail.com
Sat Feb 27 15:30:47 PST 2010


Jonathan M Davis wrote:

> Lutger wrote:
> 
>> 
>> True, it only adds AssertError and that could be replaced with regular
>> asserts.
>> 
>> Thanks.
> 
> ??? Regular asserts? When asserts in D fail, they throw an exception of
> type AssertError. So, unless you're talking about explicitly throwing an
> AssertError yourself (which seems rather silly to me), I don't know what
> you could mean by the difference of having an AssertError get thrown from
> having a "regular" assert.
> 
> - Jonathan M Davis

I wasn't clear, this is what I meant with 'regular' asserts:

void foo()
{
    assert(precondition);
}

instead of:

void foo()
in
{
    assert(precondition);
}
body
{ 
}





More information about the Digitalmars-d-learn mailing list