disable all member function calls for rvalues?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Dec 23 09:53:54 PST 2009


Michel Fortin wrote:
> On 2009-12-23 09:15:18 -0500, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> said:
> 
>> 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.
> 
> Is this one of them?
> 
>     int[5] array = [1, 2, 3, 4, 5];
>     array[1..3] = [0, 0];
> 
> Or, more likely returning a non-built-in range type is one of them:
> 
>     MyContainer container = [1, 2, 3, 4, 5];
>     container[1..3] = [0, 0];
> 
> and you'll have to write it like this:
> 
>     MyContainer container = [1, 2, 3, 4, 5];
>     MyRange range = container[1..3];
>     range = [0, 0];

That's just mean! :o)

Guess I need to acquiesce. Thanks Michel for the example.

Andrei



More information about the Digitalmars-d mailing list