Bug 18876 – Contradiction in Spec Concerning Properties

Status
NEW
Severity
major
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-05-19T16:04:40Z
Last change time
2024-12-15T15:25:03Z
Assigned to
No Owner
Creator
Bolpat
Moved to GitHub: dlang.org#4088 →

Comments

Comment #0 by qs.il.paperinik — 2018-05-19T16:04:40Z
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
Comment #1 by issues.dlang — 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.
Comment #2 by robert.schadek — 2024-12-15T15:25:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/4088 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB