class invariants and property declarations
Dmitry Olshansky
dmitry.olsh at gmail.com
Wed Feb 16 09:59:27 PST 2011
On 16.02.2011 20:47, Jesse Phillips wrote:
> Dmitry Olshansky Wrote:
>
>> Now to properties, this is actually shouldn't be allowed:
>>
>> @property int hours;
>>
>> @property is a annotation applied to functions (getter/setter), to allow calling it with omitted () and a natural assign syntax like this:
> Why shouldn't it be allowed? While it provides no benefit it does document that it is a property.
Well, it does not affect the code in any meaningful way. Also it's not
the property per see it's data member, you can even take it's address.
To me such 'features' that silently do nothing should be an error.
As to document anything then the comment does it and without the
phantom semantic load.
--
Dmitry Olshansky
More information about the Digitalmars-d-learn
mailing list