DIP28, on properties, availabel for destruction as well

angel andrey.gelman at gmail.com
Thu Feb 28 06:55:05 PST 2013


There _is_ reason.
You may, possibly, argue this reason is not important enough - 
here you might be right or wrong, I don't know.
The point is a @property should behave as close as possible to a 
real variable:

class A {
     int field;
}
auto a = new A();
auto x = a.field = 3;

Now you 'upgrade' 'field' to a @property

class A {
     int _field;
     @property ??? field(int val) {
         _field = val;
     }
}
auto a = new A();
auto x = a.field = 3;
The above line should behave _identically_ to the previous case.
Will it, if you define "@property char field(int val)" ? 
Apparently no.


More information about the Digitalmars-d mailing list