On 2/3/13 9:23 PM, kenji hara wrote:
2013/2/4 Andrei Alexandrescu <[email protected] <mailto:[email protected]>>On 2/3/13 3:16 AM, Andrei Alexandrescu wrote: [snip] Some more thinking got me to three simple principles that guide the proposed property design: http://wiki.dlang.org/DIP23#__In_a_nutshell <http://wiki.dlang.org/DIP23#In_a_nutshell> > 2. A @property may have EXACTLY ONE or EXACTLY TWO parameters, counting the implicit this parameter if at all. The ONE-parameter version is ALWAYS a getter, and the TWO-parameter version is ALWAYS a setter. There's no variadics, defaulted parameters, and such. Unfortunately, I can present a counterexample. struct S { static int value; static @property int foo() { return value; } static @property void foo(int n) { value = n; } } void main() { int n = S.foo; S.foo = 1; } Should they be disallowed, as like module level properties?
Yes. No static properties. Andrei
