@property needed or not needed?

Adam D. Ruppe destructionator at gmail.com
Tue Nov 20 05:37:03 PST 2012


On Tuesday, 20 November 2012 at 05:31:09 UTC, deadalnix wrote:
> This make it impossible to only define a getter only when one 
> want to return by reference.

If there isn't a setter, you don't change things.

If setter is present:
foo = foo + 1; // becomes: foo(foo() + 1);

If setter is not present:
foo = foo + 1; // becomes: foo() = foo() + 1;


If foo returns an rvalue, this is a natural error. If it returns 
ref, it works fine.


More information about the Digitalmars-d mailing list