disable all member function calls for rvalues?

Steven Schveighoffer schveiguy at yahoo.com
Tue Dec 22 05:41:11 PST 2009


On Tue, 22 Dec 2009 08:30:33 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Kagamin wrote:
>> Andrei Alexandrescu Wrote:
>>
>>>> I think, possible solution is to disallow assign operations on the  
>>>> return value: =, +=, *=, ~=, ++ etc, but read operations should be  
>>>> allowed and functions should be callable by their symbolical names.
>>> Won't help. Consider:
>>>
>>> a.b.c.d.e.f = g;
>>>
>>> If anywhere on the path an rvalue is created, the code is useless  
>>> busywork.
>>  In contrast with the original example this is not a bug.
>
> I think it is to the extent (a) it does nothing (b) the syntactic  
> equivalent code involving fields does something. It's an egregious  
> breakage of consistency because properties were meant to be  
> generalizations of fields in the first place.

What if a.b returns a Rebindable!(const(T)) rvalue, and the rest are  
lvalues?

-Steve



More information about the Digitalmars-d mailing list