Property discussion wrap-up

TommiT tommitissari at hotmail.com
Thu Jan 31 04:58:12 PST 2013


On Thursday, 31 January 2013 at 09:39:06 UTC, Timon Gehr wrote:
> auto v = t.myProp; // ?

I think it might be fine to allow copy-constructing 'properties', 
passing them to functions by value or by reference, and such. So, 
you could do:

void func(ref T.PropType v);

PropType v = t.myProp;
func(v);

But default-construction of 'properties' can be allowed only 
nested inside the enclosing object (to ensure that the enclosing 
object exists, and can be passed implicitly as that 'outer' 
variable to PropType's methods).

Although, I don't see much real value in allowing the kind of 
code above. So, it might be just as well to just disallow copying 
of 'properties' except when it happens as a part of copying the 
enclosing object.


More information about the Digitalmars-d mailing list