DIP28, on properties, availabel for destruction as well

deadalnix deadalnix at gmail.com
Thu Feb 28 00:21:03 PST 2013


On Thursday, 28 February 2013 at 08:02:05 UTC, Jacob Carlborg 
wrote:
> On 2013-02-28 04:00, deadalnix wrote:
>
>> The proposal is to rewrite that to auto a = b.setter(3);
>>
>> Its value is whatever the setter returns.
>
> Then setters always must return a value. I think it would be 
> better to have the compiler rewrite the expression to return 
> what the getter returns.
>

Must is not appropriate here, as it isn't an obligation at all. I 
don't really see what is the concern here.

If the function is simple, then it will be inlined and unused 
returned values can be optimized away. If the function is 
complex, the cost of returning something when not needed will be 
negligible anyway.

What is your concern here ?

>> Error, w.getter is not an lvalue.
>
> Then you cannot freely change a field to a property.
>

You can return an lvalue. But you example was returning an 
rvalue; so it is an error in this case.


More information about the Digitalmars-d mailing list