disable all member function calls for rvalues?
    Andrei Alexandrescu 
    SeeWebsiteForEmail at erdani.org
       
    Fri Dec 25 06:13:13 PST 2009
    
    
  
Kagamin wrote:
> Andrei Alexandrescu Wrote:
> 
>>> Andrei Alexandrescu Wrote:
>>> 
>>>>> 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.
> 
>>> foo().obj.unlink(); foo().obj2().unlink();
>> File does not have an unlink member but I get your point. As I
>> said, refusing to bind ref to rvalues disables a few valid uses. I
>> am willing to renounce those few uses.
> 
> So you deliberately want to break consistency between fields and
> properties? As I understnd, .obj will be allowed and .obj2 will be
> disallowed?
Properties that return rvalues cannot be fully consistent with fields 
anyway. By the change I suggested, false friends that look syntactically 
the same but do different things are avoided.
Anyway, I dropped the suggestion due to the array slice example, but I 
still think this is a serious problem with D.
Andrei
    
    
More information about the Digitalmars-d
mailing list