On Wed, Jul 29, 2009 at 10:20 AM, Dimitar Kolev<dimitarrosenovko...@hotmail.com> wrote: > Okay correct me if I am wrong but why not make properties like that: > > class a > { > int #a; > } > > The compiler can expand this to: > > int property_a(int new_a) > { > return this.a = new_a; > } > > int property_a() > { > return this.a; > } > > If you think that somebody is going to use property_a for whatever other > reason make it property_asdasdasd_a instead of property_a. > > Then just call it a#a = 3 or b = a#a =3. > > Correct me if I am wrong.
The point is to be able to start with class Foo { int a; } and later change implementation or add access monitoring without affecting all the code that already acceesses Foo's .a field. So this should compile both before and after changing Foo.a from a field to a property: Foo x; x.a = 3; x.a += 3; // ** writefln("x.a now %s", x.a); --bb ** this doesn't currently work with D when a() is a function, but it should.