disable all member function calls for rvalues?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Dec 23 06:15:18 PST 2009


Kagamin 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.
> 
> class File
> {
>   ...
> }
> 
> struct MyStruct
> {
>   File obj;
>   File obj2(){ return obj; }
> }
> 
> MyStruct foo();
> 
> foo().obj.unlink();
> foo().obj2().unlink();
> 
> Why do you think this is invalid?

I didn't think that's invalid. I was talking about the other example 
that looked like a field assignment but did not assign to a field.

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.


Andrei



More information about the Digitalmars-d mailing list