On Tuesday, 15 July 2014 at 05:26:57 UTC, Philippe Sigaud via Digitalmars-d-learn wrote:
@property allows you to call a function without the parenthesis (), to
imitate a field in a struct or class.

That was the original idea, but today the situation is that for all argument-less method calls (and UFCS calls) the parentheses are optional, but for functions with `@property` parentheses _mustn't_ be used. This was mainly done to avoid an ambiguity when the function returns something that is itself callable, but also is useful to keep APIs stable: If you mark a method as `@property`, you can replace it by a member variable and existing code will not break (but needs to be recompiled, of course).

Reply via email to