Design by Contract - some questions

BCS ao at pathlink.com
Sat Jan 27 10:47:10 PST 2007


Reply to Sérgio_Agostinho,

> 
> * is it possible to specify pre/postconditions in constructors and
> private methods?

I'm no expert, but I would assume so (I haven't checked)

> 
> * is it possible to declare local variables within the 'in', 'out' or
> 'invariant' scope?
> 

again I would assume so

> Regarding the D authors' design options, I also have some questions:
> 
> * have interface contracts been considered (since D does not support
> multiple-inheritance)?

I has been proposed, but hasn't gone anywhere. I'd like to see it and an 
interface unittest that is run for any class that implements the interface.

> 
> * has a finer grain of checking been considered, other that
> development/on and release/off (the ability to specify that contract
> checking for specific classes and/or specific assertion types)?
> 

not explicitly, but you could get that effect with the version construct.

> Thank you for your time,
> 
> Sérgio Agostinho
> 

Your welcome, and I hope you enjoy D




More information about the Digitalmars-d-learn mailing list