Mea Culpa

Jason House jason.james.house at gmail.com
Thu Mar 6 17:23:11 PST 2008


kov_serg wrote:

> Jason House Wrote:
> ...
>> 2. Any simplification of forcing non-null function inputs.
>>    Example:
>>      void foo(A a, B b, C c, D d)
>>      in{
>>        assert(a !is null, "foo can't accept null for 1st parameter");
>>        assert(b !is null, "foo can't accept null for 2nd parameter");
>>        assert(c !is null, "foo can't accept null for 3rd parameter");
>>        assert(d !is null, "foo can't accept null for 4th parameter");
>>      }
>>      body{...}
>> 
> ...
> I wounder are rules "in" and "out" inherited for virtual function or I
> should write them every time? Is where any posibilities to inherits such
> rules except mixin?

See http://www.digitalmars.com/d/1.0/dbc.html
or http://www.digitalmars.com/d/2.0/dbc.html

I'm not sure if I agree completely with the rules, but they make sense.  I
completely agree with those rules for interfaces, but it seems to partially
limit use of contracts for code testing.



More information about the Digitalmars-d mailing list