Abstract class contracts

Timon Gehr timon.gehr at gmx.ch
Mon Feb 25 14:47:38 PST 2013


On 02/25/2013 08:36 PM, H. S. Teoh wrote:
> Why does D require that in-contracts on a class method must have a
> method body? Based on my understanding of TDPL, in-contracts are
> supposed to be inherited by derived classes, aren't they? Currently I
> can't seem to convince DMD to accept an in-contract on an abstract base
> class method:
>
> 	abstract class Base {
> 		abstract int method(int j)
> 		in { assert(j < 10); }; // <-- compile error
> 	}
>
> What's the rationale for this? Doesn't it defeat the purpose of DbC (I
> want the abstract base class to "set the rules" as to what are
> acceptable parameters to methods)?
>...

http://d.puremagic.com/issues/show_bug.cgi?id=6549

Even more annoying is the following issue:
http://d.puremagic.com/issues/show_bug.cgi?id=6856


More information about the Digitalmars-d mailing list