On Monday, 19 November 2012 at 06:52:11 UTC, Andrei Alexandrescu wrote:
We need to redesign it to such that the keyword '@property' is only required in cases that otherwise would be ambiguous (functions returning functions).

There's a fairly easy way to do this, thanks to the @property word:

1) Any function without @property remains exactly the same as it is now. Parens are *not* required on them.

2) Any function with @property is rewritten into a call immediately. Therefore, putting () is naturally an error or delegate call because of the return value.

@property int foo() {}

foo; // rewritten into foo() transparently
foo(); // since foo is already foo(), this becomes foo()() - an error because you cannot call an int like a function



The only potential for code breakage here is on stuff marked @property, which if you have been marking it on semantic properties already (NOT on places where you just wanted appease the -property switch's idiotic rules), should be fine.

If in doubt, leave @property off. That leaves things exactly as they are.

Reply via email to