Conversation
[This question](https://stackoverflow.com/questions/44887077/d-properties-with-two-arguments) on stackoverflow and my personal struggling with the sentence suggests to add clarification.
|
Thanks for your pull request, @Bolpat! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
| $(LI $(D @property) functions cannot be overloaded with non-$(D @property) functions with the same name.) | ||
| $(LI $(D @property) functions can only have zero, one or two parameters.) | ||
| $(LI $(D @property) functions can only have zero or one parameter if they are non-static members.) | ||
| $(LI $(D @property) functions can only have one or two parameters if they are non-members.) |
There was a problem hiding this comment.
What does static have to do with anything? Whether the member function is static or not, if it's a getter or a setter that returns by ref, it has no parameters, and if it's a setter that does not return by ref it has one parameter. If it's a free function, then a getter has zero parameters and is used by itself, or it has one parameter and is used with UFCS, and if it's a setter, then it either has one parameter if it's used without UFCS and two if it's used with UFCS. static has no effect on any of this.
|
Okay. You clearly don't understand how Neither I don't think that there's anything wrong with what the spec currently says. It's just that it doesn't necessarily go into enough detail. If we wanted to make it clearer, we'd probably need to provide examples of non-static member functions, member functions, and free functions with getters, setters, and functions that return by |
|
The other issue here is that none of this really has much to do with |
This question on stackoverflow and my personal struggling with the sentence suggests to add clarification.
I've done some tests with static member functions.
work well. For static member functions like these
the
@propertyhas no effect: Replace(1)and(2)bybool p = x.parity;andy.parity = p;respectively, you get the error no property 'parity' for type 'int'.I don't know if this is intensional or a bug.