Property rewriting; I feel it's important. Is there still time?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Mar 10 09:10:28 PST 2010


On 03/10/2010 11:05 AM, Ellery Newcomer wrote:
> On 03/10/2010 10:48 AM, Andrei Alexandrescu wrote:
>> On 03/10/2010 08:42 AM, Andrei Alexandrescu wrote:
>>> {auto t = foo.prop; auto t1 = t; ++t1; foo.prop = t1; return t;}()
>>>
>>> within an rvalue context, and into:
>>>
>>> {auto t = foo.prop; ++t; foo.prop = t; return t;}()
>>>
>>> within a void context.
>>
>> The latter should be:
>>
>> {auto t = foo.prop; ++t; foo.prop = t;}()
>>
>> because there's no need to return a value.
>>
>>
>> Andrei
>
> no
>
> auto a = foo.prop++;
>
> ?

Not sure I understand the question. The statement you mention would end 
up lowered to:

auto a = {auto t = foo.prop; auto t1 = t; ++t1; foo.prop = t1; return t;}();

which does what the user would expect.

(Lowering is conceptual, e.g. inline code or an intrinsic named function 
could be used.)


Andrei



More information about the Digitalmars-d mailing list