@property - take it behind the woodshed and shoot it?

Timon Gehr timon.gehr at gmx.ch
Sun Jan 27 05:38:07 PST 2013


On 01/27/2013 02:27 PM, Jacob Carlborg wrote:
> On 2013-01-27 13:52, Artur Skawina wrote:
>
>> It overloads the keywords, but afaict should be unambiguous and is not
>> worse than the other meanings of 'in' (operator, modifier). But I haven't
>> really used contracts w/ D (the basic features need to work right first,
>> before worrying about extras like that); somebody who actually uses them
>> would be in a better position to determine if overloading 'in' and 'out'
>> further would be too confusing.
>
> I'm not talking about confusing. I'm thinking if it's ambiguous or not
> and how to attach contracts to a property with this syntax.
>

class A{
     private int i;
     int foo{
         out out(result){assert(result<=0);}body{return i; }
         in(int v)in{assert(v<=0);}out{assert(foo<=0);}body{ i = v; }
     }
}


More information about the Digitalmars-d mailing list