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

Robert jfanatiker at gmx.at
Thu Jan 24 14:47:44 PST 2013


Proper property design:
> 
> @property int a;
> 
gets actually lowered by the compiler to:
> 
> int a_;
> 
> @property int a() {
> return a_;
> }
> @property int a(int new_a) {
>  a_=new_a;
>  return a_;
> }
> 
-> field property, and get/set property are actually the same thing. ->
It is guaranteed that they behave the same way and can always be
exchanged.

-> Taking the address of the getter/setter also always works, enabling
things like connecting the setter to a signal for example.

I don't know about you guys, but I love this. It is just perfect. What
do I miss?

Best regards,

Robert



More information about the Digitalmars-d mailing list