You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In section "Property Functions"[1] of "Functions" page, it says on
2., second point: "@property functions can only have zero, one or two parameters."
and on
8.: "If a property function has no parameters, it works as a getter. If has exactly one parameter, it works as a setter."
These cannot be understood simultaneously. 8. implies a @property must have one or no parameters.
[1]https://dlang.org/spec/function.html#property-functions
The text was updated successfully, but these errors were encountered:
issues.dlang (@jmdavis) commented on 2018-06-01T08:14:02Z
The cases of a free function used without UFCS, a free function used with UFCS, and a member function are all different, and the number of parameters required differs. So, the spec needs to be clarified in that respect. Point #8 is correct for a free function used without UFCS or a member function, but it's wrong for a free function used with UFCS. A free function used with UFCS needs on extra parameter for both the getter and setter - hence why it's possible to have a setter property with two parameters.
But regardless, that whole section of the spec needs to be rewritten anyway, since while it was intended at one point that property functions be controlled by @property, that never actually happened. So, all of these rules relate to using any function as a property and aren't actually affected by @property.
Bolpat reported this on 2018-05-19T16:04:40Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=18876
CC List
Description
The text was updated successfully, but these errors were encountered: