Pre and Post contracts and signature constraints

Zardoz luis.panadero at gmail.com
Mon Jul 4 10:20:07 PDT 2011


How is the correct way of mix  Pre and Post contracts and signature constraints ?

I try this that looks logic way and not compile : 

T foo (T) (T a) 
if ( is(T : real)) {
 in {
	assert (a > 0); 
 }
 body {
	return a*2;
 }
}

I get this errors : 
Declaration expected, not 'if'
unrecognized declaration

And this with same result :

T foo (T) (T a) 
in {
	assert (a > 0); 
}
if ( is(T : real)) {
 body {
	return a*2;
 }
}

I'm using dmd 2.053.

-- 
Yep, I'm afraid that I have a blog : zardoz.es


More information about the Digitalmars-d-learn mailing list