DIP23 draft: Fixing properties redux

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Feb 3 10:28:09 PST 2013


On 2/3/13 1:14 PM, TommiT wrote:
> Example 1:
>
> struct S
> {
> int _n;
>
> @property ref const(int) prop() const
> {
> return _n;
> }
> }
>
> @property void prop(ref S s, int n)
> {
> s._n = 42;
> }
>
> void main()
> {
> S s;
> s.prop = 10;
> }

This is a matter of visibility. The presence of a member precludes any 
UFCS. Won't compile. Same for the 2nd example.

Andrei


More information about the Digitalmars-d mailing list