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

Adam Wilson flyboynw at gmail.com
Thu Jan 24 14:48:17 PST 2013


On Thu, 24 Jan 2013 14:47:44 -0800, Robert <jfanatiker at gmx.at> wrote:

> 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
>


The syntax provides no way to define read-only or write-only properties.  
Other than that I love it, but I am a biased C# guy.

-- 
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


More information about the Digitalmars-d mailing list